Source of file Filepath.php

Size: 0,807 Bytes - Last Modified: 2015-12-22T09:42:40-05:00

../src/Traits/Filepath.php

12345678910111213141516171819202122232425262728293031323334
Covered by 6 test(s):
  • MvcLite\ControllerTest::testInit
  • MvcLite\DispatcherTest::testInit
  • MvcLite\DispatcherTest::testDispatch with data set "good controller request"
  • MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
  • MvcLite\FilepathTraitsTest::testGetConfig with data set "string input"
  • MvcLite\FilepathTraitsTest::testGetConfig with data set "array input"
35
Covered by 4 test(s):
  • MvcLite\DispatcherTest::testInit
  • MvcLite\DispatcherTest::testDispatch with data set "good controller request"
  • MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
  • MvcLite\FilepathTraitsTest::testGetConfig with data set "string input"
36
Covered by 4 test(s):
  • MvcLite\DispatcherTest::testInit
  • MvcLite\DispatcherTest::testDispatch with data set "good controller request"
  • MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
  • MvcLite\FilepathTraitsTest::testGetConfig with data set "string input"
3738
Covered by 6 test(s):
  • MvcLite\ControllerTest::testInit
  • MvcLite\DispatcherTest::testInit
  • MvcLite\DispatcherTest::testDispatch with data set "good controller request"
  • MvcLite\DispatcherTest::testDispatch with data set "bad controller request"
  • MvcLite\FilepathTraitsTest::testGetConfig with data set "string input"
  • MvcLite\FilepathTraitsTest::testGetConfig with data set "array input"
394041
<?php
/**
 * Filepath Trait
 *
 * @category   PHP
 * @package    MvcLite
 * @subpackage Traits
 * @since      File available since release 3.0.x
 * @author     Cory Collier <corycollier@corycollier.com>
 */

namespace MvcLite\Traits;

/**
 * Filepath Trait.
 *
 * Allows a cross platform way to get filepaths
 *
 * @category   PHP
 * @package    MvcLite
 * @subpackage Traits
 * @since      File available since release 3.0.x
 * @author     Cory Collier <corycollier@corycollier.com>
 */
trait Filepath
{
    /**
     * Getter for the Request instance.
     *
     * @return MvcLite\Request The Request instance.
     */
    public function filepath($path)
    {
        if (!is_array($path)) {
            $path = explode('/', $path);
        }

        return implode(DIRECTORY_SEPARATOR, $path);
    }
}