22
33namespace Adldap \Laravel \Commands \Console ;
44
5- use Exception ;
6- use RuntimeException ;
7- use UnexpectedValueException ;
8- use Adldap \Models \User ;
5+ use Adldap \Laravel \Commands \Import as ImportUser ;
6+ use Adldap \Laravel \Commands \SyncPassword ;
97use Adldap \Laravel \Events \Imported ;
108use Adldap \Laravel \Facades \Resolver ;
11- use Adldap \Laravel \ Commands \ SyncPassword ;
12- use Adldap \ Laravel \ Commands \ Import as ImportUser ;
9+ use Adldap \Models \ User ;
10+ use Exception ;
1311use Illuminate \Console \Command ;
12+ use Illuminate \Database \Eloquent \Model ;
1413use Illuminate \Support \Facades \Bus ;
15- use Illuminate \Support \Facades \Event ;
1614use Illuminate \Support \Facades \Config ;
17- use Illuminate \Database \Eloquent \Model ;
15+ use Illuminate \Support \Facades \Event ;
16+ use RuntimeException ;
17+ use UnexpectedValueException ;
1818
1919class Import extends Command
2020{
@@ -47,10 +47,10 @@ class Import extends Command
4747 /**
4848 * Execute the console command.
4949 *
50- * @return void
51- *
5250 * @throws RuntimeException
5351 * @throws \Adldap\Models\ModelNotFoundException
52+ *
53+ * @return void
5454 */
5555 public function handle ()
5656 {
@@ -59,8 +59,8 @@ public function handle()
5959 $ count = count ($ users );
6060
6161 if ($ count === 0 ) {
62- throw new RuntimeException (" There were no users found to import. " );
63- } else if ($ count === 1 ) {
62+ throw new RuntimeException (' There were no users found to import. ' );
63+ } elseif ($ count === 1 ) {
6464 $ this ->info ("Found user ' {$ users [0 ]->getCommonName ()}'. " );
6565 } else {
6666 $ this ->info ("Found {$ count } user(s). " );
@@ -74,14 +74,14 @@ public function handle()
7474 }
7575
7676 if (
77- ! $ this ->input ->isInteractive () ||
77+ !$ this ->input ->isInteractive () ||
7878 $ this ->confirm ('Would you like these users to be imported / synchronized? ' , $ default = true )
7979 ) {
8080 $ imported = $ this ->import ($ users );
8181
8282 $ this ->info ("Successfully imported / synchronized {$ imported } user(s). " );
8383 } else {
84- $ this ->info (" Okay, no users were imported / synchronized. " );
84+ $ this ->info (' Okay, no users were imported / synchronized. ' );
8585 }
8686 }
8787
@@ -151,9 +151,9 @@ public function display(array $users = [])
151151
152152 array_map (function (User $ user ) use (&$ data ) {
153153 $ data [] = [
154- 'name ' => $ user ->getCommonName (),
154+ 'name ' => $ user ->getCommonName (),
155155 'account_name ' => $ user ->getAccountName (),
156- 'upn ' => $ user ->getUserPrincipalName (),
156+ 'upn ' => $ user ->getUserPrincipalName (),
157157 ];
158158 }, $ users );
159159
@@ -195,9 +195,9 @@ public function isRestoring() : bool
195195 /**
196196 * Retrieves users to be imported.
197197 *
198- * @return array
199- *
200198 * @throws \Adldap\Models\ModelNotFoundException
199+ *
200+ * @return array
201201 */
202202 public function getUsers () : array
203203 {
@@ -285,15 +285,15 @@ protected function restore(User $user, Model $model)
285285 * @param User $user
286286 * @param Model $model
287287 *
288- * @return void
289- *
290288 * @throws Exception
289+ *
290+ * @return void
291291 */
292292 protected function delete (User $ user , Model $ model )
293293 {
294294 if (
295295 $ this ->isUsingSoftDeletes ($ model ) &&
296- ! $ model ->trashed () &&
296+ !$ model ->trashed () &&
297297 $ user ->isDisabled ()
298298 ) {
299299 // If deleting is enabled, the model supports soft deletes, the model
@@ -316,19 +316,19 @@ protected function delete(User $user, Model $model)
316316 */
317317 protected function model () : Model
318318 {
319- if (! $ this ->model ) {
319+ if (!$ this ->model ) {
320320 $ this ->model = $ this ->option ('model ' ) ?? Config::get ('ldap_auth.model ' ) ?: $ this ->determineModel ();
321321 }
322322
323- return new $ this ->model ;
323+ return new $ this ->model () ;
324324 }
325325
326326 /**
327327 * Retrieves the model by checking the configured LDAP authentication providers.
328328 *
329- * @return string
330- *
331329 * @throws UnexpectedValueException
330+ *
331+ * @return string
332332 */
333333 protected function determineModel ()
334334 {
0 commit comments