@@ -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,45 +48,45 @@ 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 | $currentInterfaceNamespace = $baseNamespace.$folder.'\\'; |
64 | 64 | $currentImplementationNamespace = $currentInterfaceNamespace.'src'; |
65 | 65 | |
66 | 66 | // Scan files within the folder. |
67 | - $validatorInterfacesInFolder = File::files( $folderPath ); |
|
67 | + $validatorInterfacesInFolder = File::files($folderPath); |
|
68 | 68 | |
69 | - foreach( $validatorInterfacesInFolder as $validatorInterface ) |
|
69 | + foreach ($validatorInterfacesInFolder as $validatorInterface) |
|
70 | 70 | { |
71 | 71 | // For each file find the Interface and the implementation and bind them together. |
72 | - $interfaceName = pathinfo( $validatorInterface, PATHINFO_FILENAME ); |
|
72 | + $interfaceName = pathinfo($validatorInterface, PATHINFO_FILENAME); |
|
73 | 73 | |
74 | - $commonName = str_replace( 'Interface', '', $interfaceName ); |
|
74 | + $commonName = str_replace('Interface', '', $interfaceName); |
|
75 | 75 | $interfaceFullClassName = $currentInterfaceNamespace.$interfaceName; |
76 | 76 | |
77 | 77 | $fullClassName = $currentImplementationNamespace.'\\'.$commonName; |
78 | 78 | |
79 | - if ( class_exists( $fullClassName ) ) |
|
79 | + if (class_exists($fullClassName)) |
|
80 | 80 | { |
81 | 81 | // Bind the class. |
82 | - $this->app->bind( $interfaceFullClassName, function ( $app ) use ( $fullClassName ) |
|
82 | + $this->app->bind($interfaceFullClassName, function($app) use ($fullClassName) |
|
83 | 83 | { |
84 | - return $app->make( $fullClassName ); |
|
84 | + return $app->make($fullClassName); |
|
85 | 85 | }); |
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |
89 | - } catch( \Exception $e ) |
|
89 | + } catch (\Exception $e) |
|
90 | 90 | { |
91 | 91 | // Be quiet; Silence is golden. |
92 | 92 | } |