@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Exception; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Exception; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Exception; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Exception; |
| 4 | 4 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme; |
| 4 | 4 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * @inheritDoc |
| 13 | 13 | */ |
| 14 | - public function log( $level, $message, array $context = [] ) { |
|
| 14 | + public function log ( $level, $message, array $context = [ ] ) { |
|
| 15 | 15 | error_log( "$level - $message" ); |
| 16 | 16 | } |
| 17 | 17 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Exception; |
| 4 | 4 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @param string|null $title If available |
| 11 | 11 | */ |
| 12 | - public function __construct( string $title = null ) { |
|
| 12 | + public function __construct ( string $title = null ) { |
|
| 13 | 13 | if ( $title ) { |
| 14 | 14 | parent::__construct( "The specified page is protected: $title" ); |
| 15 | 15 | } else { |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Exception; |
| 4 | 4 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @param string|null $title If available |
| 11 | 11 | */ |
| 12 | - public function __construct( string $title = null ) { |
|
| 12 | + public function __construct ( string $title = null ) { |
|
| 13 | 13 | if ( $title ) { |
| 14 | 14 | parent::__construct( "The specified page doesn't exist: $title" ); |
| 15 | 15 | } else { |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme; |
| 4 | 4 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * Should only be used for debugging purpose. |
| 33 | 33 | */ |
| 34 | - public static function resetLastRunDate() { |
|
| 34 | + public static function resetLastRunDate () { |
|
| 35 | 35 | file_put_contents( self::LOG_FILE, '' ); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param string|null $taskName Only used in MODE_SINGLE |
| 43 | 43 | * @return TaskResult |
| 44 | 44 | */ |
| 45 | - public function run( int $mode, string $taskName = null ) : TaskResult { |
|
| 45 | + public function run ( int $mode, string $taskName = null ) : TaskResult { |
|
| 46 | 46 | $this->provider = new TaskDataProvider; |
| 47 | 47 | if ( $mode === self::MODE_COMPLETE ) { |
| 48 | 48 | return $this->runAllTasks(); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | /** |
| 57 | 57 | * @return TaskResult |
| 58 | 58 | */ |
| 59 | - protected function runAllTasks() : TaskResult { |
|
| 59 | + protected function runAllTasks () : TaskResult { |
|
| 60 | 60 | if ( self::getLastFullRunDate() === date( 'd/m/Y' ) ) { |
| 61 | 61 | // Really avoid executing twice the same day |
| 62 | 62 | return new TaskResult( TaskResult::STATUS_ERROR, [ 'A full run was already executed today.' ] ); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * Get the last execution date to ensure no more than one full run is executed every day |
| 87 | 87 | * @return string|null d/m/Y or null if no last run registered |
| 88 | 88 | */ |
| 89 | - public static function getLastFullRunDate() : ?string { |
|
| 89 | + public static function getLastFullRunDate () : ?string { |
|
| 90 | 90 | if ( file_exists( self::LOG_FILE ) ) { |
| 91 | 91 | return file_get_contents( self::LOG_FILE ) ?: null; |
| 92 | 92 | } else { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param string $task Defined in self::TASKS_MAP |
| 99 | 99 | * @return TaskResult |
| 100 | 100 | */ |
| 101 | - protected function runTask( string $task ) : TaskResult { |
|
| 101 | + protected function runTask ( string $task ) : TaskResult { |
|
| 102 | 102 | if ( !isset( self::TASKS_MAP[ $task ] ) ) { |
| 103 | 103 | throw new \InvalidArgumentException( "'$task' is not a valid task." ); |
| 104 | 104 | } |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | * @param string $class |
| 114 | 114 | * @return Task |
| 115 | 115 | */ |
| 116 | - private function getTaskInstance( string $class ) : Task { |
|
| 116 | + private function getTaskInstance ( string $class ) : Task { |
|
| 117 | 117 | return new $class( $this->provider ); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public static function setLastFullRunDate() { |
|
| 120 | + public static function setLastFullRunDate () { |
|
| 121 | 121 | file_put_contents( self::LOG_FILE, date( 'd/m/Y' ) ); |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme; |
| 4 | 4 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @param int $status One of the Task::STATUS_* constants |
| 21 | 21 | * @param string[] $errors |
| 22 | 22 | */ |
| 23 | - public function __construct( int $status, array $errors = [] ) { |
|
| 23 | + public function __construct ( int $status, array $errors = [ ] ) { |
|
| 24 | 24 | $this->status = $status; |
| 25 | 25 | $this->errors = $errors; |
| 26 | 26 | } |
@@ -28,21 +28,21 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @return int |
| 30 | 30 | */ |
| 31 | - public function getStatus() : int { |
|
| 31 | + public function getStatus () : int { |
|
| 32 | 32 | return $this->status; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @return string[] |
| 37 | 37 | */ |
| 38 | - public function getErrors() { |
|
| 38 | + public function getErrors () { |
|
| 39 | 39 | return $this->errors; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @param TaskResult $that |
| 44 | 44 | */ |
| 45 | - public function merge( TaskResult $that ) { |
|
| 45 | + public function merge ( TaskResult $that ) { |
|
| 46 | 46 | $this->status |= $that->status; |
| 47 | 47 | $this->errors = array_merge( $this->errors, $that->errors ); |
| 48 | 48 | } |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @return string |
| 52 | 52 | */ |
| 53 | - public function __toString() { |
|
| 53 | + public function __toString () { |
|
| 54 | 54 | if ( $this->isOK() ) { |
| 55 | 55 | $stat = 'OK'; |
| 56 | 56 | $errs = "\tNo errors."; |
| 57 | 57 | } else { |
| 58 | 58 | $stat = 'ERROR'; |
| 59 | - $formattedErrs = []; |
|
| 59 | + $formattedErrs = [ ]; |
|
| 60 | 60 | foreach ( $this->errors as $err ) { |
| 61 | - $formattedErrs[] = "\t - $err"; |
|
| 61 | + $formattedErrs[ ] = "\t - $err"; |
|
| 62 | 62 | } |
| 63 | 63 | $errs = implode( "\n", $formattedErrs ); |
| 64 | 64 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return bool |
| 72 | 72 | */ |
| 73 | - public function isOK() : bool { |
|
| 73 | + public function isOK () : bool { |
|
| 74 | 74 | return $this->status === self::STATUS_OK; |
| 75 | 75 | } |
| 76 | 76 | } |