@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | // merge default config |
| 33 | 33 | $this->mergeConfigFrom( |
| 34 | - __DIR__.$this->configPath , 'validators' |
|
| 34 | + __DIR__.$this->configPath, 'validators' |
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | // Bind the validators. |
@@ -48,44 +48,44 @@ discard block |
||
| 48 | 48 | try |
| 49 | 49 | { |
| 50 | 50 | // Load config parameters needed. |
| 51 | - $validatorsBasePath = config( 'validators.validators_path' ); |
|
| 52 | - $baseNamespace = rtrim( config( 'validators.validator_interfaces_namespace' ), '\\' ) . '\\'; |
|
| 51 | + $validatorsBasePath = config('validators.validators_path'); |
|
| 52 | + $baseNamespace = rtrim(config('validators.validator_interfaces_namespace'), '\\').'\\'; |
|
| 53 | 53 | |
| 54 | - $folders = scandir( $validatorsBasePath ); |
|
| 54 | + $folders = scandir($validatorsBasePath); |
|
| 55 | 55 | |
| 56 | 56 | // Remove the first 2 directories: "." and "..". |
| 57 | - array_shift( $folders ); |
|
| 58 | - array_shift( $folders ); |
|
| 57 | + array_shift($folders); |
|
| 58 | + array_shift($folders); |
|
| 59 | 59 | |
| 60 | - foreach( $folders as $folder ) |
|
| 60 | + foreach ($folders as $folder) |
|
| 61 | 61 | { |
| 62 | 62 | $folderPath = $validatorsBasePath.'/'.$folder; |
| 63 | 63 | $currentImplementationNamespace = $baseNamespace.$folder.'\\src'; |
| 64 | 64 | |
| 65 | 65 | // Scan files within the folder. |
| 66 | - $validatorInterfacesInFolder = File::files( $folderPath ); |
|
| 66 | + $validatorInterfacesInFolder = File::files($folderPath); |
|
| 67 | 67 | |
| 68 | - foreach( $validatorInterfacesInFolder as $validatorInterface ) |
|
| 68 | + foreach ($validatorInterfacesInFolder as $validatorInterface) |
|
| 69 | 69 | { |
| 70 | 70 | // For each file find the Interface and the implementation and bind them together. |
| 71 | - $interfaceName = pathinfo( $validatorInterface, PATHINFO_FILENAME ); |
|
| 71 | + $interfaceName = pathinfo($validatorInterface, PATHINFO_FILENAME); |
|
| 72 | 72 | |
| 73 | - $commonName = str_replace( 'Interface', '', $interfaceName ); |
|
| 73 | + $commonName = str_replace('Interface', '', $interfaceName); |
|
| 74 | 74 | $interfaceFullClassName = $baseNamespace.$interfaceName; |
| 75 | 75 | |
| 76 | 76 | $fullClassName = $currentImplementationNamespace.'\\'.$commonName; |
| 77 | 77 | |
| 78 | - if ( class_exists( $fullClassName ) ) |
|
| 78 | + if (class_exists($fullClassName)) |
|
| 79 | 79 | { |
| 80 | 80 | // Bind the class. |
| 81 | - $this->app->bind( $interfaceFullClassName, function ( $app ) use ( $fullClassName ) |
|
| 81 | + $this->app->bind($interfaceFullClassName, function($app) use ($fullClassName) |
|
| 82 | 82 | { |
| 83 | - return $app->make( $fullClassName ); |
|
| 83 | + return $app->make($fullClassName); |
|
| 84 | 84 | }); |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | - } catch( \Exception $e ) |
|
| 88 | + } catch (\Exception $e) |
|
| 89 | 89 | { |
| 90 | 90 | // Be quiet; Silence is golden. |
| 91 | 91 | } |