Skip to content

Commit

Permalink
PHP CS
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Mar 7, 2016
1 parent 1b9096d commit 60d7515
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function get($source)
* Get absolute path to a file or a directory.
*
* @param $source (example: "default:file.txt")
* @return array()
* @return array
*/
public function glob($source)
{
Expand Down Expand Up @@ -351,7 +351,7 @@ public function url($source, $full = true)
*/
public function rel($source)
{
$fullpath = $this->get($source);
$fullpath = (string)$this->get($source);
return FS::getRelative($fullpath, $this->_root, '/');
}

Expand All @@ -363,7 +363,7 @@ public function rel($source)
*/
public function relGlob($source)
{
$list = $this->glob($source);
$list = (array)$this->glob($source);
foreach ($list as $key => $item) {
$list[$key] = FS::getRelative($item, $this->_root, '/');
}
Expand All @@ -381,14 +381,14 @@ public function relGlob($source)
*/
protected function _addNewPath($path, $alias, $mode)
{
$path = $this->_cleanPath($path);
if ($path !== null) {
if ($cleanPath = $this->_cleanPath($path)) {

if ($mode == self::MOD_PREPEND) {
array_unshift($this->_paths[$alias], $path);
array_unshift($this->_paths[$alias], $cleanPath);
}

if ($mode == self::MOD_APPEND) {
array_push($this->_paths[$alias], $path);
array_push($this->_paths[$alias], $cleanPath);
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions tests/performanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function testCompareWithRealpath()

return $result;
},
), array('count' => 500, 'name' => 'Compare with realpath'));
), array('count' => 1000, 'name' => 'Compare with realpath'));
}

public function testPathResolver()
Expand All @@ -83,7 +83,7 @@ public function testPathResolver()
$virtPath->set('default', $root);

runBench(array(
'new path (new)' => function () use ($fs, $root) {
'new path (new obj and dir)' => function () use ($fs, $root) {

$newDir = $root . mt_rand();
$fs->mkdir($newDir);
Expand All @@ -94,8 +94,6 @@ public function testPathResolver()
$result = $virtPath->get('default:');
// end

$fs->remove($result);

return $result;
},
'same path (new)' => function () use ($fs, $root) {
Expand Down

0 comments on commit 60d7515

Please sign in to comment.