@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | foreach ($checkServiceMap as $checkId => $check) { |
| 49 | 49 | |
| 50 | 50 | $checkServiceId = $check['serviceId']; |
| 51 | - $checkProxy = new Proxy(function () use ($checkServiceId, $checkId) { |
|
| 51 | + $checkProxy = new Proxy(function() use ($checkServiceId, $checkId) { |
|
| 52 | 52 | $this->checks[$checkId] = $this->container->get($checkServiceId); |
| 53 | 53 | |
| 54 | 54 | return $this->checks[$checkId]; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $groups = is_string($groups) ? [$groups] : $groups; |
| 97 | 97 | |
| 98 | - return array_filter($this->groups, function ($t) use ($groups) { |
|
| 98 | + return array_filter($this->groups, function($t) use ($groups) { |
|
| 99 | 99 | return in_array($t->getName(), $groups); |
| 100 | 100 | }); |
| 101 | 101 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $tags = is_string($tags) ? [$tags] : $tags; |
| 126 | 126 | |
| 127 | - return array_filter($this->tags, function ($t) use ($tags) { |
|
| 127 | + return array_filter($this->tags, function($t) use ($tags) { |
|
| 128 | 128 | return in_array($t->getName(), $tags); |
| 129 | 129 | }); |
| 130 | 130 | } |
@@ -85,19 +85,19 @@ |
||
| 85 | 85 | */ |
| 86 | 86 | public function setAdditionParams(array $data) |
| 87 | 87 | { |
| 88 | - if(isset($data['id'])) { |
|
| 88 | + if (isset($data['id'])) { |
|
| 89 | 89 | $this->setId($data['id']); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if(isset($data['group'])) { |
|
| 92 | + if (isset($data['group'])) { |
|
| 93 | 93 | $this->setGroup($data['group']); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if(isset($data['tags'])) { |
|
| 96 | + if (isset($data['tags'])) { |
|
| 97 | 97 | $this->setTags($data['tags']); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if(isset($data['label'])) { |
|
| 100 | + if (isset($data['label'])) { |
|
| 101 | 101 | $this->/** @scrutinizer ignore-call */setLabel($data['label']); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function offsetGet($offset) |
| 36 | 36 | { |
| 37 | - if($this->checks[$offset] instanceof Proxy) { |
|
| 37 | + if ($this->checks[$offset] instanceof Proxy) { |
|
| 38 | 38 | $this->checks[$offset] = $this->checks[$offset](); |
| 39 | 39 | } |
| 40 | 40 | return $this->checks[$offset]; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function valid() |
| 92 | 92 | { |
| 93 | - return (boolean)key($this->checks); |
|
| 93 | + return (boolean) key($this->checks); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function toArray() |
| 108 | 108 | { |
| 109 | - $out = []; |
|
| 109 | + $out = []; |
|
| 110 | 110 | foreach ($this as $k => $v) { |
| 111 | 111 | $out[$k] = $v; |
| 112 | 112 | } |
@@ -20,8 +20,8 @@ |
||
| 20 | 20 | ->children() |
| 21 | 21 | ->arrayNode('check') |
| 22 | 22 | ->beforeNormalization() |
| 23 | - ->always(function ($value) { |
|
| 24 | - if(isset($value['extensionName']) && !is_array($value['extensionName'])) { |
|
| 23 | + ->always(function($value) { |
|
| 24 | + if (isset($value['extensionName']) && !is_array($value['extensionName'])) { |
|
| 25 | 25 | $value['extensionName'] = [$value['extensionName']]; |
| 26 | 26 | } |
| 27 | 27 | return $value; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $checkDefinition = clone $checkDefinitionTpl; |
| 30 | 30 | |
| 31 | 31 | if ($name) { |
| 32 | - $checkServiceAlias .= '.' . $name; |
|
| 32 | + $checkServiceAlias .= '.'.$name; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | foreach ($checkDefinition->getArguments() as $argumentIndex => $argument) { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | //$loader->load('controller.yml'); |
| 41 | 41 | //$loader->load('telega.yml'); |
| 42 | 42 | |
| 43 | - $checksSearchPaths = isset($configs[1]['checks_search_paths'])?$configs[1]['checks_search_paths']:[]; |
|
| 43 | + $checksSearchPaths = isset($configs[1]['checks_search_paths']) ? $configs[1]['checks_search_paths'] : []; |
|
| 44 | 44 | unset($configs[1]['checks_search_paths']); |
| 45 | 45 | |
| 46 | 46 | $configuration = new Configuration($checksSearchPaths); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | if (isset($config['checks'])) { |
| 75 | 75 | |
| 76 | - $config['checks'] = array_filter($config['checks'], function ($i) {return $i;}); |
|
| 76 | + $config['checks'] = array_filter($config['checks'], function($i) {return $i; }); |
|
| 77 | 77 | |
| 78 | 78 | $containerParams = []; |
| 79 | 79 | $checksLoaded = []; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $checkMatadata = $checkMatadatas[$checkName]; |
| 85 | 85 | $service = $checkMatadata['service']; |
| 86 | 86 | |
| 87 | - $path = $checkMatadata['path']. DIRECTORY_SEPARATOR . $checkMatadata['conf']; |
|
| 87 | + $path = $checkMatadata['path'].DIRECTORY_SEPARATOR.$checkMatadata['conf']; |
|
| 88 | 88 | |
| 89 | 89 | if (!in_array($path, $checksLoaded)) { |
| 90 | 90 | |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | $checksLoaded[] = $path; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if(isset($checkSettings['items'])) { |
|
| 95 | + if (isset($checkSettings['items'])) { |
|
| 96 | 96 | |
| 97 | 97 | $items = $checkSettings['items']; |
| 98 | 98 | |
| 99 | 99 | foreach ($items as $itemName => &$item) { |
| 100 | 100 | $item['tags'] = array_unique(array_merge($item['tags'], $checkSettings['tags'])); |
| 101 | 101 | |
| 102 | - if($item['label'] == null && $checkSettings['label'] != null) { |
|
| 102 | + if ($item['label'] == null && $checkSettings['label'] != null) { |
|
| 103 | 103 | $label = $checkSettings['label']; |
| 104 | 104 | $label = sprintf($label, $itemName); |
| 105 | 105 | $item['label'] = $label; |
@@ -56,8 +56,8 @@ |
||
| 56 | 56 | ]; |
| 57 | 57 | |
| 58 | 58 | $data = $result->getData(); |
| 59 | - if($data !== null) { |
|
| 60 | - if($data instanceof \Exception) { |
|
| 59 | + if ($data !== null) { |
|
| 60 | + if ($data instanceof \Exception) { |
|
| 61 | 61 | $res['data'] = $data->getMessage(); |
| 62 | 62 | } else { |
| 63 | 63 | $res['data'] = $data; |
@@ -79,10 +79,10 @@ |
||
| 79 | 79 | $message = $result->getMessage(); |
| 80 | 80 | if ($message) { |
| 81 | 81 | $data = $result->getData(); |
| 82 | - if($data !== null) { |
|
| 82 | + if ($data !== null) { |
|
| 83 | 83 | $dataOut = json_encode($data); |
| 84 | 84 | |
| 85 | - if(strlen($dataOut) > 100) { |
|
| 85 | + if (strlen($dataOut) > 100) { |
|
| 86 | 86 | $dataOut .= "\n"; |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function __construct(array $dirs = null) |
| 15 | 15 | { |
| 16 | - if($dirs) { |
|
| 16 | + if ($dirs) { |
|
| 17 | 17 | $this->searchDirs = array_merge($this->searchDirs, $dirs); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | $this->parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); |
| 21 | - $this->traverser = new NodeTraverser; |
|
| 21 | + $this->traverser = new NodeTraverser; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | public function leaveNode(\PhpParser\Node $node) { |
| 42 | 42 | |
| 43 | 43 | if ($node instanceof \PhpParser\Node\Stmt\Namespace_) { |
| 44 | - $this->namespace = $node->name . ''; |
|
| 44 | + $this->namespace = $node->name.''; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if ($node instanceof \PhpParser\Node\Stmt\Class_) { |
| 48 | - $this->class = $node->name . ''; |
|
| 48 | + $this->class = $node->name.''; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function getClass() |
| 58 | 58 | { |
| 59 | - if($this->namespace && $this->class) { |
|
| 59 | + if ($this->namespace && $this->class) { |
|
| 60 | 60 | $res = sprintf('%s\%s', $this->namespace, $this->class); |
| 61 | 61 | return $res; |
| 62 | 62 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $class = $vis->getClass(); |
| 82 | 82 | |
| 83 | - if(is_subclass_of($class, CheckConfigInterface::class)) { |
|
| 83 | + if (is_subclass_of($class, CheckConfigInterface::class)) { |
|
| 84 | 84 | $res[] = $class; |
| 85 | 85 | } |
| 86 | 86 | |