@@ -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 | * Entry point for the bot, called by CLI |
| 4 | 4 | */ |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | /* URL (for debugging purpose) */ |
| 38 | 38 | $url = getopt( '', [ 'force-url:' ] ); |
| 39 | -if ( isset( $url['force-url'] ) ) { |
|
| 40 | - RequestBase::$url = $url['force-url']; |
|
| 39 | +if ( isset( $url[ 'force-url' ] ) ) { |
|
| 40 | + RequestBase::$url = $url[ 'force-url' ]; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /* PASSWORD */ |
@@ -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 | } |