Passed
Branch master (3a32fb)
by Volodymyr
02:51
created
Category
src/UaLibs.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,112 +33,112 @@  discard block
 block discarded – undo
33 33
 	 * @return array
34 34
 	 */
35 35
 	public function get(): array {
36
-		return $this->getUserAgents( null );
36
+		return $this->getUserAgents(null);
37 37
 	}
38 38
 
39 39
 	/**
40 40
 	 * @return null|string
41 41
 	 */
42 42
 	public function getRandom(): ?string {
43
-		return array_rand( $this->getUserAgents( null ) );
43
+		return array_rand($this->getUserAgents(null));
44 44
 	}
45 45
 
46 46
 	/**
47 47
 	 * @return array
48 48
 	 */
49 49
 	public function getAndroid(): array {
50
-		return $this->getUserAgents( 'android' );
50
+		return $this->getUserAgents('android');
51 51
 	}
52 52
 
53 53
 	/**
54 54
 	 * @return null|string
55 55
 	 */
56 56
 	public function getAndroidRandom(): ?string {
57
-		return array_rand( $this->getAndroid() );
57
+		return array_rand($this->getAndroid());
58 58
 	}
59 59
 
60 60
 	/**
61 61
 	 * @return array
62 62
 	 */
63 63
 	public function getChrome(): array {
64
-		return $this->getUserAgents( 'chrome' );
64
+		return $this->getUserAgents('chrome');
65 65
 	}
66 66
 
67 67
 	/**
68 68
 	 * @return null|string
69 69
 	 */
70 70
 	public function getChromeRandom(): ?string {
71
-		return array_rand( $this->getChrome() );
71
+		return array_rand($this->getChrome());
72 72
 	}
73 73
 
74 74
 	/**
75 75
 	 * @return array
76 76
 	 */
77 77
 	public function getEdge(): array {
78
-		return $this->getUserAgents( 'edge' );
78
+		return $this->getUserAgents('edge');
79 79
 	}
80 80
 
81 81
 	/**
82 82
 	 * @return null|string
83 83
 	 */
84 84
 	public function getEdgeRandom(): ?string {
85
-		return array_rand( $this->getEdge() );
85
+		return array_rand($this->getEdge());
86 86
 	}
87 87
 
88 88
 	/**
89 89
 	 * @return array
90 90
 	 */
91 91
 	public function getFirefox(): array {
92
-		return $this->getUserAgents( 'firefox' );
92
+		return $this->getUserAgents('firefox');
93 93
 	}
94 94
 
95 95
 	/**
96 96
 	 * @return null|string
97 97
 	 */
98 98
 	public function getFirefoxRandom(): ?string {
99
-		return array_rand( $this->getFirefox() );
99
+		return array_rand($this->getFirefox());
100 100
 	}
101 101
 
102 102
 	/**
103 103
 	 * @return array
104 104
 	 */
105 105
 	public function getInternetExplorer(): array {
106
-		return $this->getUserAgents( 'ie' );
106
+		return $this->getUserAgents('ie');
107 107
 	}
108 108
 
109 109
 	/**
110 110
 	 * @return null|string
111 111
 	 */
112 112
 	public function getInternetExplorerRandom(): ?string {
113
-		return array_rand( $this->getInternetExplorer() );
113
+		return array_rand($this->getInternetExplorer());
114 114
 	}
115 115
 
116 116
 	/**
117 117
 	 * @return array
118 118
 	 */
119 119
 	public function getOpera(): array {
120
-		return $this->getUserAgents( 'opera' );
120
+		return $this->getUserAgents('opera');
121 121
 	}
122 122
 
123 123
 	/**
124 124
 	 * @return null|string
125 125
 	 */
126 126
 	public function getOperaRandom(): ?string {
127
-		return array_rand( $this->getOpera() );
127
+		return array_rand($this->getOpera());
128 128
 	}
129 129
 
130 130
 	/**
131 131
 	 * @return array
132 132
 	 */
133 133
 	public function getSafari(): array {
134
-		return $this->getUserAgents( 'safari' );
134
+		return $this->getUserAgents('safari');
135 135
 	}
136 136
 
137 137
 	/**
138 138
 	 * @return null|string
139 139
 	 */
140 140
 	public function getSafariRandom(): ?string {
141
-		return array_rand( $this->getSafari() );
141
+		return array_rand($this->getSafari());
142 142
 	}
143 143
 
144 144
 	/**
@@ -146,22 +146,22 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return array
148 148
 	 */
149
-	protected function getUserAgents( ?string $lib ): array {
150
-		if ( ! empty( $lib ) ) {
149
+	protected function getUserAgents(?string $lib): array {
150
+		if ( ! empty($lib)) {
151 151
 			$lib_path = __DIR__ . '/libs/' . $lib . '.txt';
152 152
 
153
-			return file_exists( $lib_path ) ? file( $lib_path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ) : [];
153
+			return file_exists($lib_path) ? file($lib_path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) : [ ];
154 154
 		} else {
155
-			$list = [];
155
+			$list = [ ];
156 156
 			// combine all available libs and return it as array
157
-			foreach ( new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( __DIR__ . '/libs' ) ) as $filename ) {
157
+			foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . '/libs')) as $filename) {
158 158
 				// filter out "." and ".."
159
-				if ( $filename->isDir() ) {
159
+				if ($filename->isDir()) {
160 160
 					continue;
161 161
 				}
162
-				$list = array_merge( $list, file( $filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ) );
162
+				$list = array_merge($list, file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
163 163
 			}
164
-			$list = array_values( array_unique( $list ) );
164
+			$list = array_values(array_unique($list));
165 165
 
166 166
 			return $list;
167 167
 		}
Please login to merge, or discard this patch.