@@ -44,7 +44,7 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
4444 throw new FileNotFoundException (sprintf ('Failed to copy "%s" because file does not exist. ' , $ originFile ), 0 , null , $ originFile );
4545 }
4646
47- $ this ->mkdir (dirname ($ targetFile ));
47+ $ this ->mkdir (\ dirname ($ targetFile ));
4848
4949 $ doCopy = true ;
5050 if (!$ overwriteNewerFiles && null === parse_url ($ originFile , PHP_URL_HOST ) && is_file ($ targetFile )) {
@@ -121,7 +121,7 @@ public function exists($files)
121121 $ maxPathLength = PHP_MAXPATHLEN - 2 ;
122122
123123 foreach ($ this ->toIterable ($ files ) as $ file ) {
124- if (strlen ($ file ) > $ maxPathLength ) {
124+ if (\ strlen ($ file ) > $ maxPathLength ) {
125125 throw new IOException (sprintf ('Could not check if file exist because path length exceeds %d characters. ' , $ maxPathLength ), 0 , null , $ file );
126126 }
127127
@@ -163,7 +163,7 @@ public function remove($files)
163163 {
164164 if ($ files instanceof \Traversable) {
165165 $ files = iterator_to_array ($ files , false );
166- } elseif (!is_array ($ files )) {
166+ } elseif (!\ is_array ($ files )) {
167167 $ files = array ($ files );
168168 }
169169 $ files = array_reverse ($ files );
@@ -222,7 +222,7 @@ public function chown($files, $user, $recursive = false)
222222 if ($ recursive && is_dir ($ file ) && !is_link ($ file )) {
223223 $ this ->chown (new \FilesystemIterator ($ file ), $ user , true );
224224 }
225- if (is_link ($ file ) && function_exists ('lchown ' )) {
225+ if (is_link ($ file ) && \ function_exists ('lchown ' )) {
226226 if (true !== @lchown ($ file , $ user )) {
227227 throw new IOException (sprintf ('Failed to chown file "%s". ' , $ file ), 0 , null , $ file );
228228 }
@@ -249,8 +249,8 @@ public function chgrp($files, $group, $recursive = false)
249249 if ($ recursive && is_dir ($ file ) && !is_link ($ file )) {
250250 $ this ->chgrp (new \FilesystemIterator ($ file ), $ group , true );
251251 }
252- if (is_link ($ file ) && function_exists ('lchgrp ' )) {
253- if (true !== @lchgrp ($ file , $ group ) || (defined ('HHVM_VERSION ' ) && !posix_getgrnam ($ group ))) {
252+ if (is_link ($ file ) && \ function_exists ('lchgrp ' )) {
253+ if (true !== @lchgrp ($ file , $ group ) || (\ defined ('HHVM_VERSION ' ) && !posix_getgrnam ($ group ))) {
254254 throw new IOException (sprintf ('Failed to chgrp file "%s". ' , $ file ), 0 , null , $ file );
255255 }
256256 } else {
@@ -303,7 +303,7 @@ private function isReadable($filename)
303303 {
304304 $ maxPathLength = PHP_MAXPATHLEN - 2 ;
305305
306- if (strlen ($ filename ) > $ maxPathLength ) {
306+ if (\ strlen ($ filename ) > $ maxPathLength ) {
307307 throw new IOException (sprintf ('Could not check if file is readable because path length exceeds %d characters. ' , $ maxPathLength ), 0 , null , $ filename );
308308 }
309309
@@ -332,7 +332,7 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
332332 }
333333 }
334334
335- $ this ->mkdir (dirname ($ targetDir ));
335+ $ this ->mkdir (\ dirname ($ targetDir ));
336336
337337 if (is_link ($ targetDir )) {
338338 if (readlink ($ targetDir ) === $ originDir ) {
@@ -456,7 +456,7 @@ public function makePathRelative($endPath, $startPath)
456456 }
457457
458458 $ stripDriveLetter = function ($ path ) {
459- if (strlen ($ path ) > 2 && ': ' === $ path [1 ] && '/ ' === $ path [2 ] && ctype_alpha ($ path [0 ])) {
459+ if (\ strlen ($ path ) > 2 && ': ' === $ path [1 ] && '/ ' === $ path [2 ] && ctype_alpha ($ path [0 ])) {
460460 return substr ($ path , 2 );
461461 }
462462
@@ -474,7 +474,7 @@ public function makePathRelative($endPath, $startPath)
474474 $ result = array ();
475475
476476 foreach ($ pathSegments as $ segment ) {
477- if ('.. ' === $ segment && ($ absolute || count ($ result ))) {
477+ if ('.. ' === $ segment && ($ absolute || \ count ($ result ))) {
478478 array_pop ($ result );
479479 } elseif ('. ' !== $ segment ) {
480480 $ result [] = $ segment ;
@@ -494,16 +494,16 @@ public function makePathRelative($endPath, $startPath)
494494 }
495495
496496 // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels)
497- if (1 === count ($ startPathArr ) && '' === $ startPathArr [0 ]) {
497+ if (1 === \ count ($ startPathArr ) && '' === $ startPathArr [0 ]) {
498498 $ depth = 0 ;
499499 } else {
500- $ depth = count ($ startPathArr ) - $ index ;
500+ $ depth = \ count ($ startPathArr ) - $ index ;
501501 }
502502
503503 // Repeated "../" for each level need to reach the common path
504504 $ traverser = str_repeat ('../ ' , $ depth );
505505
506- $ endPathRemainder = implode ('/ ' , array_slice ($ endPathArr , $ index ));
506+ $ endPathRemainder = implode ('/ ' , \ array_slice ($ endPathArr , $ index ));
507507
508508 // Construct $endPath from traversing to the common path, then to the remaining $endPath
509509 $ relativePath = $ traverser .('' !== $ endPathRemainder ? $ endPathRemainder .'/ ' : '' );
@@ -534,7 +534,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
534534 {
535535 $ targetDir = rtrim ($ targetDir , '/ \\' );
536536 $ originDir = rtrim ($ originDir , '/ \\' );
537- $ originDirLen = strlen ($ originDir );
537+ $ originDirLen = \ strlen ($ originDir );
538538
539539 // Iterate in destination folder to remove obsolete entries
540540 if ($ this ->exists ($ targetDir ) && isset ($ options ['delete ' ]) && $ options ['delete ' ]) {
@@ -543,7 +543,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
543543 $ flags = \FilesystemIterator::SKIP_DOTS ;
544544 $ deleteIterator = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ targetDir , $ flags ), \RecursiveIteratorIterator::CHILD_FIRST );
545545 }
546- $ targetDirLen = strlen ($ targetDir );
546+ $ targetDirLen = \ strlen ($ targetDir );
547547 foreach ($ deleteIterator as $ file ) {
548548 $ origin = $ originDir .substr ($ file ->getPathname (), $ targetDirLen );
549549 if (!$ this ->exists ($ origin )) {
@@ -601,7 +601,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
601601 public function isAbsolutePath ($ file )
602602 {
603603 return strspn ($ file , '/ \\' , 0 , 1 )
604- || (strlen ($ file ) > 3 && ctype_alpha ($ file [0 ])
604+ || (\ strlen ($ file ) > 3 && ctype_alpha ($ file [0 ])
605605 && ': ' === $ file [1 ]
606606 && strspn ($ file , '/ \\' , 2 , 1 )
607607 )
@@ -671,7 +671,7 @@ public function tempnam($dir, $prefix)
671671 */
672672 public function dumpFile ($ filename , $ content )
673673 {
674- $ dir = dirname ($ filename );
674+ $ dir = \ dirname ($ filename );
675675
676676 if (!is_dir ($ dir )) {
677677 $ this ->mkdir ($ dir );
@@ -704,7 +704,7 @@ public function dumpFile($filename, $content)
704704 */
705705 public function appendToFile ($ filename , $ content )
706706 {
707- $ dir = dirname ($ filename );
707+ $ dir = \ dirname ($ filename );
708708
709709 if (!is_dir ($ dir )) {
710710 $ this ->mkdir ($ dir );
@@ -726,7 +726,7 @@ public function appendToFile($filename, $content)
726726 */
727727 private function toIterable ($ files )
728728 {
729- return is_array ($ files ) || $ files instanceof \Traversable ? $ files : array ($ files );
729+ return \ is_array ($ files ) || $ files instanceof \Traversable ? $ files : array ($ files );
730730 }
731731
732732 /**
@@ -740,7 +740,7 @@ private function getSchemeAndHierarchy($filename)
740740 {
741741 $ components = explode (':// ' , $ filename , 2 );
742742
743- return 2 === count ($ components ) ? array ($ components [0 ], $ components [1 ]) : array (null , $ components [0 ]);
743+ return 2 === \ count ($ components ) ? array ($ components [0 ], $ components [1 ]) : array (null , $ components [0 ]);
744744 }
745745
746746 private static function box ($ func )
0 commit comments