@@ -85,9 +85,9 @@ public function generateAllPolicies(): void
8585 }
8686
8787 return $ reflection ->isSubclassOf (Model::class) &&
88- ! $ reflection ->isAbstract ();
88+ !$ reflection ->isAbstract ();
8989 })
90- ->map (fn ($ model ) => Str::afterLast ($ model , '\\' ));
90+ ->map (fn ($ model ) => Str::afterLast ($ model , '\\' ));
9191
9292 $ models ->each (function (string $ model ) {
9393 $ this ->generatePolicy ($ model , $ model );
@@ -104,7 +104,7 @@ public function generatePlainPolicy(string $name): void
104104 {
105105 if (
106106 file_exists ($ this ->getPolicyPath ($ name )) &&
107- ! $ this ->option ('force ' )
107+ !$ this ->option ('force ' )
108108 ) {
109109 $ this ->error (sprintf ('Policy "%s" already exists! ' , $ name ));
110110
@@ -116,8 +116,8 @@ public function generatePlainPolicy(string $name): void
116116 'namespace ' => $ this ->getNamespace (),
117117 'class ' => $ this ->getClassName ($ name ),
118118 ])->reduce (
119- fn ($ carry , $ value , $ key ) => Str::replace (
120- '{{ ' . $ key. ' }} ' ,
119+ fn ($ carry , $ value , $ key ) => Str::replace (
120+ '{{ ' . $ key . ' }} ' ,
121121 $ value ,
122122 $ carry
123123 )
@@ -137,7 +137,7 @@ private function generatePolicy(string $name, string $model): void
137137 {
138138 if (
139139 file_exists ($ this ->getPolicyPath ($ name )) &&
140- ! $ this ->option ('force ' )
140+ !$ this ->option ('force ' )
141141 ) {
142142 $ this ->error (sprintf ('Policy "%s" already exists! ' , $ name ));
143143
@@ -147,7 +147,8 @@ private function generatePolicy(string $name, string $model): void
147147 $ compiled = collect ([
148148 'name ' => $ name ,
149149 'model ' => $ model ,
150- 'modelVariable ' => strtolower ($ model ) ===
150+ 'modelVariable ' =>
151+ strtolower ($ model ) ===
151152 strtolower (
152153 Str::afterLast ($ this ->getNamespacedUserModel (), '\\' )
153154 )
@@ -161,8 +162,8 @@ private function generatePolicy(string $name, string $model): void
161162 'namespacedUserModel ' => $ this ->getNamespacedUserModel (),
162163 'user ' => Str::afterLast ($ this ->getNamespacedUserModel (), '\\' ),
163164 ])->reduce (
164- static fn ($ old , $ value , $ key ) => Str::replace (
165- '{{ ' . $ key. ' }} ' ,
165+ static fn ($ old , $ value , $ key ) => Str::replace (
166+ '{{ ' . $ key . ' }} ' ,
166167 $ value ,
167168 $ old
168169 ),
@@ -175,11 +176,12 @@ private function generatePolicy(string $name, string $model): void
175176 /**
176177 * Get the path to the policy.
177178 *
179+ * @param string $name
178180 * @return string
179181 */
180182 public function getPolicyPath (string $ name ): string
181183 {
182- return app_path ('Policies/ ' . $ this ->getClassName ($ name ). '.php ' );
184+ return app_path ('Policies/ ' . $ this ->getClassName ($ name ) . '.php ' );
183185 }
184186
185187 /**
@@ -189,7 +191,7 @@ public function getPolicyPath(string $name): string
189191 */
190192 public function getNamespace (): string
191193 {
192- return app ()->getNamespace (). 'Policies ' ;
194+ return app ()->getNamespace () . 'Policies ' ;
193195 }
194196
195197 /**
@@ -204,7 +206,7 @@ public function getClassName(string $name): string
204206 return Str::studly ($ name );
205207 }
206208
207- return Str::studly ($ name ). 'Policy ' ;
209+ return Str::studly ($ name ) . 'Policy ' ;
208210 }
209211
210212 /**
@@ -215,7 +217,7 @@ public function getClassName(string $name): string
215217 */
216218 public function getNamespacedModel (string $ model ): string
217219 {
218- return app ()->getNamespace (). 'Models \\' . Str::studly ($ model );
220+ return app ()->getNamespace () . 'Models \\' . Str::studly ($ model );
219221 }
220222
221223 /**
@@ -235,6 +237,6 @@ public function getNamespacedUserModel(): string
235237 */
236238 public function getStub (): string
237239 {
238- return __DIR__ . '/stubs/policy.stub ' ;
240+ return __DIR__ . '/stubs/policy.stub ' ;
239241 }
240242}
0 commit comments