@@ -8,7 +8,6 @@ |
||
| 8 | 8 | namespace allejo\stakx\Manager; |
| 9 | 9 | |
| 10 | 10 | use allejo\stakx\Object\FrontMatterObject; |
| 11 | -use Symfony\Component\Finder\Finder; |
|
| 12 | 11 | use Symfony\Component\Finder\SplFileInfo; |
| 13 | 12 | |
| 14 | 13 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | protected $tracking; |
| 78 | 78 | |
| 79 | - public function __construct() |
|
| 79 | + public function __construct () |
|
| 80 | 80 | { |
| 81 | 81 | parent::__construct(); |
| 82 | 82 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param string $filePath |
| 135 | 135 | * @param string|null $namespace |
| 136 | 136 | */ |
| 137 | - public function delArrayFromTracker($key, $filePath, $namespace = null) |
|
| 137 | + public function delArrayFromTracker ($key, $filePath, $namespace = null) |
|
| 138 | 138 | { |
| 139 | 139 | if (is_null($namespace)) |
| 140 | 140 | { |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @param array $includes |
| 262 | 262 | * @param array $excludes |
| 263 | 263 | */ |
| 264 | - public function scanTrackableItems($path, $options = array(), $includes = array(), $excludes = array()) |
|
| 264 | + public function scanTrackableItems ($path, $options = array(), $includes = array(), $excludes = array()) |
|
| 265 | 265 | { |
| 266 | 266 | $fe = FileExplorer::create($path, $excludes, $includes); |
| 267 | 267 | $fileExplorer = $fe->getExplorer(); |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace allejo\stakx\Manager; |
| 4 | 4 | |
| 5 | 5 | use allejo\stakx\System\Folder; |
| 6 | -use Symfony\Component\Finder\SplFileInfo; |
|
| 7 | 6 | |
| 8 | 7 | class AssetManager extends TrackingManager |
| 9 | 8 | { |
@@ -36,8 +36,8 @@ |
||
| 36 | 36 | * FileExplorer constructor. |
| 37 | 37 | * |
| 38 | 38 | * @param \RecursiveIterator $iterator |
| 39 | - * @param array $excludes |
|
| 40 | - * @param array $includes |
|
| 39 | + * @param string[] $excludes |
|
| 40 | + * @param string[] $includes |
|
| 41 | 41 | */ |
| 42 | 42 | public function __construct(\RecursiveIterator $iterator, array $excludes = array(), array $includes = array()) |
| 43 | 43 | { |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @var string[] |
| 18 | 18 | */ |
| 19 | - public static $vcsPatterns = array('.git', '.hg', '.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr'); |
|
| 19 | + public static $vcsPatterns = array('.git', '.hg', '.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr'); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * A list of phrases to exclude from the search |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param array $excludes |
| 40 | 40 | * @param array $includes |
| 41 | 41 | */ |
| 42 | - public function __construct(\RecursiveIterator $iterator, array $excludes = array(), array $includes = array()) |
|
| 42 | + public function __construct (\RecursiveIterator $iterator, array $excludes = array(), array $includes = array()) |
|
| 43 | 43 | { |
| 44 | 44 | parent::__construct($iterator); |
| 45 | 45 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @return string |
| 52 | 52 | */ |
| 53 | - public function __toString() |
|
| 53 | + public function __toString () |
|
| 54 | 54 | { |
| 55 | 55 | return $this->current()->getFilename(); |
| 56 | 56 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return SplFileInfo |
| 75 | 75 | */ |
| 76 | - public function current() |
|
| 76 | + public function current () |
|
| 77 | 77 | { |
| 78 | 78 | /** @var \SplFileInfo $current */ |
| 79 | 79 | $current = parent::current(); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * {@inheritdoc} |
| 90 | 90 | */ |
| 91 | - public function getChildren() |
|
| 91 | + public function getChildren () |
|
| 92 | 92 | { |
| 93 | 93 | return (new self( |
| 94 | 94 | $this->getInnerIterator()->getChildren(), |
@@ -62,8 +62,12 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $filePath = str_replace(getcwd() . '/', '', $this->current()->getPathname()); |
| 64 | 64 | |
| 65 | - if ($this->strpos_array($filePath, $this->includes)) { return true; } |
|
| 66 | - if (preg_match('#(^|/)\..+(/|$)#', $filePath) === 1) { return false; } |
|
| 65 | + if ($this->strpos_array($filePath, $this->includes)) |
|
| 66 | + { |
|
| 67 | +return true; } |
|
| 68 | + if (preg_match('#(^|/)\..+(/|$)#', $filePath) === 1) |
|
| 69 | + { |
|
| 70 | +return false; } |
|
| 67 | 71 | |
| 68 | 72 | return ($this->strpos_array($filePath, $this->excludes) === false); |
| 69 | 73 | } |
@@ -141,10 +145,13 @@ discard block |
||
| 141 | 145 | |
| 142 | 146 | foreach ($needle as $query) |
| 143 | 147 | { |
| 144 | - if (strpos($haystack, $query, $offset) !== false) // stop on first true result |
|
| 148 | + if (strpos($haystack, $query, $offset) !== false) |
|
| 149 | + { |
|
| 150 | + // stop on first true result |
|
| 145 | 151 | { |
| 146 | 152 | return true; |
| 147 | 153 | } |
| 154 | + } |
|
| 148 | 155 | } |
| 149 | 156 | |
| 150 | 157 | return false; |
@@ -171,9 +171,9 @@ |
||
| 171 | 171 | public function removeExtension ($filename) |
| 172 | 172 | { |
| 173 | 173 | return $this->appendPath( |
| 174 | - $this->getFolderPath($filename), |
|
| 175 | - $this->getBaseName($filename) |
|
| 176 | - ); |
|
| 174 | + $this->getFolderPath($filename), |
|
| 175 | + $this->getBaseName($filename) |
|
| 176 | + ); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |