@@ -46,7 +46,7 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | public function __getToArrayCallBack() |
| 48 | 48 | { |
| 49 | - return function ($subject) { |
|
| 49 | + return function($subject) { |
|
| 50 | 50 | static::$__depth++; |
| 51 | 51 | |
| 52 | 52 | if ($subject instanceof Arrayable) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | private function computeHealthForAllTargets($resource) |
| 45 | 45 | { |
| 46 | - return $resource->targets->reduce(function ($carry, $target) { |
|
| 46 | + return $resource->targets->reduce(function($carry, $target) { |
|
| 47 | 47 | return $target->result->healthy; |
| 48 | 48 | }, true); |
| 49 | 49 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | protected function isHealthy() |
| 57 | 57 | { |
| 58 | - $healthy = $this->target->resource->resources->reduce(function ( |
|
| 58 | + $healthy = $this->target->resource->resources->reduce(function( |
|
| 59 | 59 | $carry, |
| 60 | 60 | $item |
| 61 | 61 | ) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if ( |
| 43 | 43 | is_array($filters = config($configKey = 'health.resources.enabled')) |
| 44 | 44 | ) { |
| 45 | - return collect($resources)->filter(function ($resource, $name) use ( |
|
| 45 | + return collect($resources)->filter(function($resource, $name) use ( |
|
| 46 | 46 | $filters |
| 47 | 47 | ) { |
| 48 | 48 | foreach ($filters as $filter) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function load() |
| 81 | 81 | { |
| 82 | - if (! empty($this->resources)) { |
|
| 82 | + if (!empty($this->resources)) { |
|
| 83 | 83 | return $this->resources; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | return $this->replaceExecutableCode( |
| 99 | 99 | $this->loadResourcesFiles() |
| 100 | - )->mapWithKeys(function ($value, $key) { |
|
| 100 | + )->mapWithKeys(function($value, $key) { |
|
| 101 | 101 | return [$this->removeExtension($key) => $value]; |
| 102 | 102 | }); |
| 103 | 103 | } |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | private function replaceExecutableCode($files) |
| 111 | 111 | { |
| 112 | - return $files->map(function ($item) { |
|
| 112 | + return $files->map(function($item) { |
|
| 113 | 113 | return collect($item) |
| 114 | - ->map(function ($value) { |
|
| 114 | + ->map(function($value) { |
|
| 115 | 115 | return (new Resolver())->recursivelyFindAndReplaceExecutableCode( |
| 116 | 116 | $value |
| 117 | 117 | ); |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | private function sanitizeResources($resources) |
| 182 | 182 | { |
| 183 | - return $resources->map(function ($resource) { |
|
| 184 | - return collect($resource)->mapWithKeys(function ($value, $key) { |
|
| 183 | + return $resources->map(function($resource) { |
|
| 184 | + return collect($resource)->mapWithKeys(function($value, $key) { |
|
| 185 | 185 | return [$this->sanitizeKey($key) => $value]; |
| 186 | 186 | }); |
| 187 | 187 | }); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function __load() |
| 20 | 20 | { |
| 21 | - if (! file_exists($file = $this->getDatabaseFileName())) { |
|
| 21 | + if (!file_exists($file = $this->getDatabaseFileName())) { |
|
| 22 | 22 | return collect(); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -47,6 +47,9 @@ |
||
| 47 | 47 | return config('health.database.enabled'); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | + /** |
|
| 51 | + * @param \PragmaRX\Health\Support\Target $target |
|
| 52 | + */ |
|
| 50 | 53 | protected function saveResultsToDatabase($target, $result) |
| 51 | 54 | { |
| 52 | 55 | $model = config('health.database.model', HealthCheck::class); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function check() |
| 18 | 18 | { |
| 19 | 19 | foreach ($this->target->paths as $path) { |
| 20 | - if (! $this->getFilesystem()->isWritable($path)) { |
|
| 20 | + if (!$this->getFilesystem()->isWritable($path)) { |
|
| 21 | 21 | return $this->makeResult( |
| 22 | 22 | false, |
| 23 | 23 | sprintf($this->target->getErrorMessage(), $path) |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $dir = dirname($fileName); |
| 57 | 57 | |
| 58 | - if (! file_exists($dir)) { |
|
| 58 | + if (!file_exists($dir)) { |
|
| 59 | 59 | mkdir($dir, 0775, true); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function load() |
| 144 | 144 | { |
| 145 | - if (! file_exists($file = $this->getFileName())) { |
|
| 145 | + if (!file_exists($file = $this->getFileName())) { |
|
| 146 | 146 | return collect(); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $data = $this->database->toArray(); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if (! is_array($data)) { |
|
| 163 | + if (!is_array($data)) { |
|
| 164 | 164 | $data = $data->toArray(); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * Create base directory for files. |
| 35 | 35 | * |
| 36 | - * @param $fileName |
|
| 36 | + * @param string $fileName |
|
| 37 | 37 | */ |
| 38 | 38 | protected function makeDir($fileName) |
| 39 | 39 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * Make a result from an exception. |
| 71 | 71 | * |
| 72 | - * @param $exception |
|
| 72 | + * @param \Exception $exception |
|
| 73 | 73 | * @return Result |
| 74 | 74 | */ |
| 75 | 75 | protected function makeResultFromException($exception) |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | $messages = []; |
| 56 | 56 | |
| 57 | 57 | $result = collect($this->getFiles()) |
| 58 | - ->map(function ($files, $type) use (&$messages) { |
|
| 58 | + ->map(function($files, $type) use (&$messages) { |
|
| 59 | 59 | $isGood = true; |
| 60 | 60 | |
| 61 | 61 | $files = collect($files); |
| 62 | 62 | |
| 63 | 63 | foreach ($files as $file) { |
| 64 | - if (! is_null($file)) { |
|
| 64 | + if (!is_null($file)) { |
|
| 65 | 65 | foreach ($this->getCheckers($type) as $checker) { |
| 66 | 66 | if (is_string($message = $checker($file))) { |
| 67 | 67 | $messages[] = $message; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | return $isGood; |
| 75 | 75 | }) |
| 76 | - ->filter(function ($value) { |
|
| 76 | + ->filter(function($value) { |
|
| 77 | 77 | return $value === false; |
| 78 | 78 | }); |
| 79 | 79 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function buildFileExistsChecker() |
| 99 | 99 | { |
| 100 | - return function ($file) { |
|
| 100 | + return function($file) { |
|
| 101 | 101 | return $this->fileExists($file); |
| 102 | 102 | }; |
| 103 | 103 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function buildFileDoesNotExistsChecker() |
| 111 | 111 | { |
| 112 | - return function ($file) { |
|
| 112 | + return function($file) { |
|
| 113 | 113 | return $this->fileDoesNotExists($file); |
| 114 | 114 | }; |
| 115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function buildIsDirectoryChecker() |
| 123 | 123 | { |
| 124 | - return function ($file) { |
|
| 124 | + return function($file) { |
|
| 125 | 125 | return $this->isDirectory($file); |
| 126 | 126 | }; |
| 127 | 127 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function fileDoesNotExists($file) |
| 178 | 178 | { |
| 179 | - if (! file_exists($file)) { |
|
| 179 | + if (!file_exists($file)) { |
|
| 180 | 180 | return true; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -37,6 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @param \Exception|\Throwable |
| 40 | + * @param \Throwable $exception |
|
| 40 | 41 | */ |
| 41 | 42 | protected function exceptionResult($exception) |
| 42 | 43 | { |
@@ -49,7 +50,7 @@ discard block |
||
| 49 | 50 | /** |
| 50 | 51 | * Target factory. |
| 51 | 52 | * |
| 52 | - * @param $resource |
|
| 53 | + * @param Resource $resource |
|
| 53 | 54 | * @param $data |
| 54 | 55 | * @return Target |
| 55 | 56 | */ |
@@ -172,7 +173,7 @@ discard block |
||
| 172 | 173 | /** |
| 173 | 174 | * Get result error message. |
| 174 | 175 | * |
| 175 | - * @return mixed |
|
| 176 | + * @return null|string |
|
| 176 | 177 | */ |
| 177 | 178 | public function getErrorMessage() |
| 178 | 179 | { |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('health_checks', function (Blueprint $table) { |
|
| 15 | + Schema::create('health_checks', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | |
| 18 | 18 | $table->string('resource_name'); |