@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->bubble = $bubble; |
| 23 | 23 | |
| 24 | 24 | if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { |
| 25 | - throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); |
|
| 25 | + throw new \RuntimeException("The given handler (" . json_encode($this->handler) . ") is not a callable nor a Monolog\Handler\HandlerInterface object"); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function handle(array $record) |
| 35 | 35 | { |
| 36 | - if (! $this->handler instanceof HandlerInterface) { |
|
| 36 | + if (!$this->handler instanceof HandlerInterface) { |
|
| 37 | 37 | $this->handler = call_user_func($this->handler, $record, $this); |
| 38 | - if (! $this->handler instanceof HandlerInterface) { |
|
| 38 | + if (!$this->handler instanceof HandlerInterface) { |
|
| 39 | 39 | throw new \RuntimeException("The factory callable should return a HandlerInterface"); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | $this->lolifier = $lolifier; |
| 22 | 22 | $this->bubble = $bubble; |
| 23 | 23 | |
| 24 | - if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { |
|
| 24 | + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) |
|
| 25 | + { |
|
| 25 | 26 | throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); |
| 26 | 27 | } |
| 27 | 28 | } |
@@ -33,17 +34,21 @@ discard block |
||
| 33 | 34 | |
| 34 | 35 | public function handle(array $record) |
| 35 | 36 | { |
| 36 | - if (! $this->handler instanceof HandlerInterface) { |
|
| 37 | + if (! $this->handler instanceof HandlerInterface) |
|
| 38 | + { |
|
| 37 | 39 | $this->handler = call_user_func($this->handler, $record, $this); |
| 38 | - if (! $this->handler instanceof HandlerInterface) { |
|
| 40 | + if (! $this->handler instanceof HandlerInterface) |
|
| 41 | + { |
|
| 39 | 42 | throw new \RuntimeException("The factory callable should return a HandlerInterface"); |
| 40 | 43 | } |
| 41 | 44 | } |
| 42 | 45 | |
| 43 | 46 | $record = $this->lolifier->lolify($record); |
| 44 | 47 | |
| 45 | - if ($this->processors) { |
|
| 46 | - foreach ($this->processors as $processor) { |
|
| 48 | + if ($this->processors) |
|
| 49 | + { |
|
| 50 | + foreach ($this->processors as $processor) |
|
| 51 | + { |
|
| 47 | 52 | $record = call_user_func($processor, $record); |
| 48 | 53 | } |
| 49 | 54 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function lolify(array $record) |
| 15 | 15 | { |
| 16 | - if($this->countDifferentWordsInMessage($record['message']) <= 1) |
|
| 16 | + if ($this->countDifferentWordsInMessage($record['message']) <= 1) |
|
| 17 | 17 | { |
| 18 | 18 | return $record; |
| 19 | 19 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $shuffledMessageArray = $this->shuffleArray($messageArray); |
| 52 | 52 | } |
| 53 | - while($messageArray === $shuffledMessageArray); |
|
| 53 | + while ($messageArray === $shuffledMessageArray); |
|
| 54 | 54 | |
| 55 | 55 | return $this->convertArrayToString($shuffledMessageArray); |
| 56 | 56 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | { |
| 34 | 34 | $quotes = $this->provider->getQuotes(); |
| 35 | 35 | |
| 36 | - if(empty($quotes)) |
|
| 36 | + if (empty($quotes)) |
|
| 37 | 37 | { |
| 38 | 38 | return null; |
| 39 | 39 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | |
| 18 | 18 | public function lolify(array $record) |
| 19 | 19 | { |
| 20 | - if($record['level'] > Logger::INFO) |
|
| 20 | + if ($record['level'] > Logger::INFO) |
|
| 21 | 21 | { |
| 22 | 22 | $record['message'] = self::MESSAGE; |
| 23 | 23 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | $badWords = $this->swearWordsProvider->getSwearWords(); |
| 26 | 26 | |
| 27 | 27 | $iterations = rand(1, 3); |
| 28 | - for($i = 0; $i < $iterations; $i++) |
|
| 28 | + for ($i = 0; $i < $iterations; $i++) |
|
| 29 | 29 | { |
| 30 | 30 | $badWord = $this->chooseBadWordRandomly($badWords); |
| 31 | 31 | $this->insertSwearWordIntoMessage($messageArray, $badWord); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | private function travelIntoWarp(\DateTime $datetime) |
| 26 | 26 | { |
| 27 | - foreach($this->getMeasuresOfTime() as $measure => $prefix) |
|
| 27 | + foreach ($this->getMeasuresOfTime() as $measure => $prefix) |
|
| 28 | 28 | { |
| 29 | 29 | $interval = rand(self::MIN_INTERVAL, self::MAX_INTERVAL); |
| 30 | 30 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $quotes = array(); |
| 20 | 20 | |
| 21 | - foreach($this->providers as $provider) |
|
| 21 | + foreach ($this->providers as $provider) |
|
| 22 | 22 | { |
| 23 | 23 | $quotes = array_merge($quotes, $provider->getQuotes()); |
| 24 | 24 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function add(QuoteProvider $provider) |
| 30 | 30 | { |
| 31 | - if(! in_array($provider, $this->providers)) |
|
| 31 | + if (!in_array($provider, $this->providers)) |
|
| 32 | 32 | { |
| 33 | 33 | $this->providers[] = $provider; |
| 34 | 34 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | |
| 21 | 21 | private function isGeekTime(\Datetime $dateTime) |
| 22 | 22 | { |
| 23 | - if($dateTime->format('H:i') == '13:37') |
|
| 23 | + if ($dateTime->format('H:i') == '13:37') |
|
| 24 | 24 | { |
| 25 | 25 | return true; |
| 26 | 26 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $nbWords = str_word_count($message); |
| 27 | 27 | |
| 28 | - if($nbWords > 1) |
|
| 28 | + if ($nbWords > 1) |
|
| 29 | 29 | { |
| 30 | 30 | $posHalfSentence = floor(strlen($message) / 2); |
| 31 | 31 | $message = substr($message, 0, strpos($message, ' ', $posHalfSentence)) . self::MESSAGE; |