Passed
Push — master ( f5104b...99af1c )
by Domenico
03:18
created
src/Utils/Files.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
      *
19 19
      * @return array|mixed
20 20
      */
21
-    public static function pathInfo( string $path, ?int $options = 15 ) {
22
-        $rawPath = explode( DIRECTORY_SEPARATOR, $path );
21
+    public static function pathInfo(string $path, ?int $options = 15) {
22
+        $rawPath = explode(DIRECTORY_SEPARATOR, $path);
23 23
 
24
-        $basename = array_pop( $rawPath );
25
-        $dirname  = implode( DIRECTORY_SEPARATOR, $rawPath );
24
+        $basename = array_pop($rawPath);
25
+        $dirname  = implode(DIRECTORY_SEPARATOR, $rawPath);
26 26
 
27
-        $explodedFileName = explode( ".", $basename );
28
-        $extension        = strtolower( array_pop( $explodedFileName ) );
29
-        $filename         = implode( ".", $explodedFileName );
27
+        $explodedFileName = explode(".", $basename);
28
+        $extension        = strtolower(array_pop($explodedFileName));
29
+        $filename         = implode(".", $explodedFileName);
30 30
 
31 31
         $returnArray = [];
32 32
 
@@ -39,17 +39,17 @@  discard block
 block discarded – undo
39 39
 
40 40
         // foreach flag, add in $return_array the corresponding field,
41 41
         // obtained by variable name correspondence
42
-        foreach ( $flagMap as $field => $i ) {
42
+        foreach ($flagMap as $field => $i) {
43 43
             //binary AND
44
-            if ( ( $options & $i ) > 0 ) {
44
+            if (($options & $i) > 0) {
45 45
                 //variable substitution: $field can be one between 'dirname', 'basename', 'extension', 'filename'
46 46
                 // $$field gets the value of the variable named $field
47
-                $returnArray[ $field ] = $$field;
47
+                $returnArray[$field] = $$field;
48 48
             }
49 49
         }
50 50
 
51
-        if ( count( $returnArray ) == 1 ) {
52
-            $returnArray = array_pop( $returnArray );
51
+        if (count($returnArray) == 1) {
52
+            $returnArray = array_pop($returnArray);
53 53
         }
54 54
 
55 55
         return $returnArray;
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return ?string
62 62
      */
63
-    public static function getExtension( $path ): ?string {
64
-        $pathInfo = self::pathInfo( $path );
63
+    public static function getExtension($path): ?string {
64
+        $pathInfo = self::pathInfo($path);
65 65
 
66
-        if ( empty( $pathInfo ) ) {
66
+        if (empty($pathInfo)) {
67 67
             return null;
68 68
         }
69 69
 
70
-        return strtolower( $pathInfo[ 'extension' ] );
70
+        return strtolower($pathInfo['extension']);
71 71
     }
72 72
 
73 73
     /**
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @return bool
77 77
      */
78
-    public static function isXliff( ?string $path ): bool {
79
-        $extension = self::getExtension( $path );
78
+    public static function isXliff(?string $path): bool {
79
+        $extension = self::getExtension($path);
80 80
 
81
-        if ( !$extension ) {
81
+        if (!$extension) {
82 82
             return false;
83 83
         }
84 84
 
85
-        switch ( $extension ) {
85
+        switch ($extension) {
86 86
             case 'xliff':
87 87
             case 'sdlxliff':
88 88
             case 'tmx':
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
      *
99 99
      * @return bool|string
100 100
      */
101
-    public static function getMemoryFileType( string $path ) {
102
-        $pathInfo = self::pathInfo( $path );
101
+    public static function getMemoryFileType(string $path) {
102
+        $pathInfo = self::pathInfo($path);
103 103
 
104
-        if ( empty( $pathInfo ) ) {
104
+        if (empty($pathInfo)) {
105 105
             return false;
106 106
         }
107 107
 
108
-        switch ( strtolower( $pathInfo[ 'extension' ] ) ) {
108
+        switch (strtolower($pathInfo['extension'])) {
109 109
             case 'tmx':
110 110
                 return 'tmx';
111 111
             default:
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
      *
119 119
      * @return bool
120 120
      */
121
-    public static function isTMXFile( $path ): bool {
122
-        return self::getMemoryFileType( $path ) === 'tmx';
121
+    public static function isTMXFile($path): bool {
122
+        return self::getMemoryFileType($path) === 'tmx';
123 123
     }
124 124
 
125 125
     /**
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
      *
128 128
      * @return bool
129 129
      */
130
-    public static function isGlossaryFile( $path ): bool {
131
-        return self::getMemoryFileType( $path ) === 'glossary'; // return false
130
+    public static function isGlossaryFile($path): bool {
131
+        return self::getMemoryFileType($path) === 'glossary'; // return false
132 132
     }
133 133
 
134 134
 }
Please login to merge, or discard this patch.