@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @param array $data |
12 | 12 | * @return |
13 | 13 | */ |
14 | - public function parse(Notification &$notification, array $data) |
|
14 | + public function parse(Notification&$notification, array $data) |
|
15 | 15 | { |
16 | 16 | $message = $notification->getMessageTemplate(); |
17 | 17 | //get all words in {} brackets |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | foreach ($vars[1] as $var) { |
20 | 20 | //if $data has key named as previous fetched word we replace it with $data value |
21 | 21 | if (isset($data[$var])) { |
22 | - $message = preg_replace("{{" . $var . "}}", $data[$var], $message); |
|
22 | + $message = preg_replace("{{".$var."}}", $data[$var], $message); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | $notification->setMessage($message); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | public function __construct() |
13 | 13 | { |
14 | - if (! is_callable('curl_init')) { |
|
14 | + if (!is_callable('curl_init')) { |
|
15 | 15 | throw new Exception('Curl function is not callable'); |
16 | 16 | } |
17 | 17 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * @access private |
70 | 70 | * @param Trigger $trigger |
71 | 71 | * @param array $serverData |
72 | - * @return \Monitor\Notification\Notification |
|
72 | + * @return Notification|null |
|
73 | 73 | */ |
74 | 74 | public function prepareNotification(Trigger $trigger, array $serverData) |
75 | 75 | { |
@@ -95,7 +95,7 @@ |
||
95 | 95 | $triggerId, |
96 | 96 | $serverId |
97 | 97 | ); |
98 | - if ( ! $queryResult) { |
|
98 | + if (!$queryResult) { |
|
99 | 99 | return true; |
100 | 100 | } |
101 | 101 | $timeOfLastFiredUpTrigger = $queryResult[0]['created']; |
@@ -21,13 +21,13 @@ |
||
21 | 21 | return $this->moreThan($value, $trigger->getValue()); |
22 | 22 | |
23 | 23 | case "<": |
24 | - return ! $this->moreThan($value, $trigger->getValue()); |
|
24 | + return !$this->moreThan($value, $trigger->getValue()); |
|
25 | 25 | |
26 | 26 | case "=": |
27 | 27 | return $this->equal($value, $trigger->getValue()); |
28 | 28 | |
29 | 29 | case "!=": |
30 | - return ! $this->equal($value, $trigger->getValue()); |
|
30 | + return !$this->equal($value, $trigger->getValue()); |
|
31 | 31 | } |
32 | 32 | return false; |
33 | 33 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | */ |
88 | 88 | private function isFileReadable($fullPath) |
89 | 89 | { |
90 | - if ( ! is_readable($fullPath)) { |
|
90 | + if (!is_readable($fullPath)) { |
|
91 | 91 | throw new \Exception('Config is not readable'); |
92 | 92 | } |
93 | 93 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function convertToArray($data) |
14 | 14 | { |
15 | 15 | $array = json_decode($data, true); |
16 | - if ( ! is_array($array)) { |
|
16 | + if (!is_array($array)) { |
|
17 | 17 | $array = []; |
18 | 18 | } |
19 | 19 | return $array; |
@@ -13,11 +13,11 @@ |
||
13 | 13 | public function convertToArray($data) |
14 | 14 | { |
15 | 15 | $xml = simplexml_load_string($data); |
16 | - if ( ! $xml) { |
|
16 | + if (!$xml) { |
|
17 | 17 | throw new \Exception('Cant\'t parse xml'); |
18 | 18 | } |
19 | 19 | $array = json_decode(json_encode((array) $xml), true); |
20 | - if ( ! is_array($array)) { |
|
20 | + if (!is_array($array)) { |
|
21 | 21 | $array = []; |
22 | 22 | } |
23 | 23 | return $array; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | private function isClientValid() |
127 | 127 | { |
128 | - if ( ! $this->client) { |
|
128 | + if (!$this->client) { |
|
129 | 129 | throw new \Exception('Client is not valid'); |
130 | 130 | } |
131 | 131 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | { |
193 | 193 | $resources = $this->client->getResources(); |
194 | 194 | |
195 | - if ( ! $resources) { |
|
195 | + if (!$resources) { |
|
196 | 196 | $resources = json_encode( |
197 | 197 | ['status' => 'offline'] |
198 | 198 | ); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | /** |
81 | 81 | * Set client |
82 | 82 | * |
83 | - * @param \Monitor\Client\ClientInterface $client |
|
83 | + * @param ClientInterface $client |
|
84 | 84 | */ |
85 | 85 | public function setClient(ClientInterface $client) |
86 | 86 | { |
@@ -7,7 +7,7 @@ |
||
7 | 7 | public function getService($className) |
8 | 8 | { |
9 | 9 | $className = __NAMESPACE__.'\\'.$className; |
10 | - if ( ! class_exists($className)) { |
|
10 | + if (!class_exists($className)) { |
|
11 | 11 | throw new \Exception($className.' Service class not found'); |
12 | 12 | } |
13 | 13 | return new $className; |