@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Logger; |
| 4 | 4 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param Page $logPage |
| 27 | 27 | * @param string $minlevel |
| 28 | 28 | */ |
| 29 | - public function __construct( Page $logPage, $minlevel = LogLevel::INFO ) { |
|
| 29 | + public function __construct ( Page $logPage, $minlevel = LogLevel::INFO ) { |
|
| 30 | 30 | $this->minLevel = $this->levelToInt( $minlevel ); |
| 31 | 31 | $this->logPage = $logPage; |
| 32 | 32 | } |
@@ -35,16 +35,16 @@ discard block |
||
| 35 | 35 | * @inheritDoc |
| 36 | 36 | * @suppress PhanUnusedPublicMethodParameter |
| 37 | 37 | */ |
| 38 | - public function log( $level, $message, array $context = [] ) :void { |
|
| 38 | + public function log ( $level, $message, array $context = [ ] ) :void { |
|
| 39 | 39 | if ( $this->levelToInt( $level ) >= $this->minLevel ) { |
| 40 | - $this->buffer[] = $this->getFormattedMessage( $level, $message ); |
|
| 40 | + $this->buffer[ ] = $this->getFormattedMessage( $level, $message ); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @return string |
| 46 | 46 | */ |
| 47 | - protected function getOutput() : string { |
|
| 47 | + protected function getOutput () : string { |
|
| 48 | 48 | $line = str_repeat( '-', 80 ); |
| 49 | 49 | return "\n\n" . implode( "\n", $this->buffer ) . "\n$line\n\n"; |
| 50 | 50 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @inheritDoc |
| 54 | 54 | */ |
| 55 | - public function flush() : void { |
|
| 55 | + public function flush () : void { |
|
| 56 | 56 | if ( $this->buffer ) { |
| 57 | 57 | $this->logPage->edit( [ |
| 58 | 58 | 'appendtext' => $this->getOutput(), |
@@ -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 LoggerInterface $logger |
| 21 | 21 | * @param Wiki $wiki |
| 22 | 22 | */ |
| 23 | - public function __construct( LoggerInterface $logger, Wiki $wiki ) { |
|
| 23 | + public function __construct ( LoggerInterface $logger, Wiki $wiki ) { |
|
| 24 | 24 | $this->logger = $logger; |
| 25 | 25 | $this->wiki = $wiki; |
| 26 | 26 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param string $mode |
| 32 | 32 | * @param string|null $name |
| 33 | 33 | */ |
| 34 | - private function run( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) : void { |
|
| 34 | + private function run ( string $mode = TaskManager::MODE_COMPLETE, string $name = null ) : void { |
|
| 35 | 35 | $activity = $mode === TaskManager::MODE_COMPLETE ? TaskManager::MODE_COMPLETE : "$mode $name"; |
| 36 | 36 | $this->logger->info( "Running $activity" ); |
| 37 | 37 | $manager = new TaskManager( $this->logger, $this->wiki ); |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | $base = "Execution of $activity"; |
| 40 | 40 | if ( $res->isOK() ) { |
| 41 | 41 | $msg = $res->getStatus() === TaskResult::STATUS_NOTHING ? |
| 42 | - ': nothing to do' : |
|
| 43 | - ' completed successfully'; |
|
| 42 | + ': nothing to do' : ' completed successfully'; |
|
| 44 | 43 | $this->logger->info( $base . $msg ); |
| 45 | 44 | } else { |
| 46 | 45 | $this->logger->error( "$base failed.\n$res" ); |
@@ -50,7 +49,7 @@ discard block |
||
| 50 | 49 | /** |
| 51 | 50 | * Entry point for the whole process |
| 52 | 51 | */ |
| 53 | - public function runAll() : void { |
|
| 52 | + public function runAll () : void { |
|
| 54 | 53 | $this->run(); |
| 55 | 54 | } |
| 56 | 55 | |
@@ -59,7 +58,7 @@ discard block |
||
| 59 | 58 | * |
| 60 | 59 | * @param string $task |
| 61 | 60 | */ |
| 62 | - public function runTask( string $task ) : void { |
|
| 61 | + public function runTask ( string $task ) : void { |
|
| 63 | 62 | $this->run( TaskManager::MODE_TASK, $task ); |
| 64 | 63 | } |
| 65 | 64 | |
@@ -68,7 +67,7 @@ discard block |
||
| 68 | 67 | * |
| 69 | 68 | * @param string $subtask |
| 70 | 69 | */ |
| 71 | - public function runSubtask( string $subtask ) : void { |
|
| 70 | + public function runSubtask ( string $subtask ) : void { |
|
| 72 | 71 | $this->run( TaskManager::MODE_SUBTASK, $subtask ); |
| 73 | 72 | } |
| 74 | 73 | } |
@@ -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 | |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * @return bool |
| 59 | 59 | */ |
| 60 | - public static function isCLI() : bool { |
|
| 60 | + public static function isCLI () : bool { |
|
| 61 | 61 | return PHP_SAPI === 'cli'; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * Populate options and check for required ones |
| 66 | 66 | */ |
| 67 | - public function __construct() { |
|
| 67 | + public function __construct () { |
|
| 68 | 68 | $opts = getopt( self::SHORT_OPTS, self::LONG_OPTS ); |
| 69 | 69 | $this->checkRequiredOpts( $opts ); |
| 70 | 70 | $this->checkConflictingOpts( $opts ); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /** |
| 76 | 76 | * @param array $opts |
| 77 | 77 | */ |
| 78 | - private function checkRequiredOpts( array $opts ) : void { |
|
| 78 | + private function checkRequiredOpts ( array $opts ) : void { |
|
| 79 | 79 | $missingOpts = array_diff( self::REQUIRED_OPTS, array_keys( $opts ) ); |
| 80 | 80 | if ( $missingOpts ) { |
| 81 | 81 | exit( 'Required options missing: ' . implode( ', ', $missingOpts ) ); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * @param array $opts |
| 93 | 93 | */ |
| 94 | - private function checkConflictingOpts( array $opts ) : void { |
|
| 94 | + private function checkConflictingOpts ( array $opts ) : void { |
|
| 95 | 95 | $hasPw = array_key_exists( 'password', $opts ); |
| 96 | 96 | $hasPwFile = array_key_exists( 'use-password-file', $opts ); |
| 97 | 97 | if ( $hasPw && $hasPwFile ) { |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * @param array &$opts |
| 110 | 110 | */ |
| 111 | - private function canonicalize( array &$opts ) : void { |
|
| 111 | + private function canonicalize ( array &$opts ) : void { |
|
| 112 | 112 | if ( array_key_exists( 'use-password-file', $opts ) ) { |
| 113 | 113 | $pw = trim( file_get_contents( self::PASSWORD_FILE ) ); |
| 114 | - $opts['password'] = $pw; |
|
| 115 | - unset( $opts['use-password-file'] ); |
|
| 114 | + $opts[ 'password' ] = $pw; |
|
| 115 | + unset( $opts[ 'use-password-file' ] ); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * These are the options required by Config. |
| 121 | 121 | * @return array |
| 122 | 122 | */ |
| 123 | - public function getMainOpts() : array { |
|
| 123 | + public function getMainOpts () : array { |
|
| 124 | 124 | return array_intersect_key( |
| 125 | 125 | $this->opts, |
| 126 | 126 | array_fill_keys( Config::REQUIRED_OPTS, true ) |
@@ -132,14 +132,14 @@ discard block |
||
| 132 | 132 | * @param mixed|null $default |
| 133 | 133 | * @return mixed |
| 134 | 134 | */ |
| 135 | - public function getOpt( string $opt, $default = null ) { |
|
| 136 | - return $this->opts[$opt] ?? $default; |
|
| 135 | + public function getOpt ( string $opt, $default = null ) { |
|
| 136 | + return $this->opts[ $opt ] ?? $default; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * @return array Either [ 'task' => taskname ] or [ 'subtask' => subtaskname ] |
| 141 | 141 | */ |
| 142 | - public function getTaskOpt() : array { |
|
| 142 | + public function getTaskOpt () : array { |
|
| 143 | 143 | return array_intersect_key( |
| 144 | 144 | $this->opts, |
| 145 | 145 | [ 'task' => true, 'subtask' => true ] |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | /** |
| 150 | 150 | * @return string|null |
| 151 | 151 | */ |
| 152 | - public function getURL() : ?string { |
|
| 152 | + public function getURL () : ?string { |
|
| 153 | 153 | return $this->getOpt( 'force-url' ); |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** @var self */ |
| 22 | 22 | private static $instance; |
| 23 | 23 | /** @var array */ |
| 24 | - private $opts = []; |
|
| 24 | + private $opts = [ ]; |
|
| 25 | 25 | /** @var array|null Lazy-loaded to avoid unnecessary requests */ |
| 26 | 26 | private $messages; |
| 27 | 27 | /** @var Wiki */ |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param Wiki $wiki |
| 34 | 34 | */ |
| 35 | - private function __construct( Wiki $wiki ) { |
|
| 35 | + private function __construct ( Wiki $wiki ) { |
|
| 36 | 36 | $this->wiki = $wiki; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | * @param Wiki $wiki |
| 44 | 44 | * @throws ConfigException |
| 45 | 45 | */ |
| 46 | - public static function init( array $defaults, Wiki $wiki ) : void { |
|
| 46 | + public static function init ( array $defaults, Wiki $wiki ) : void { |
|
| 47 | 47 | if ( self::$instance ) { |
| 48 | 48 | throw new ConfigException( 'Config was already initialized' ); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $inst = new self( $wiki ); |
| 52 | - $inst->set( 'list-title', $defaults['list-title'] ); |
|
| 53 | - $inst->set( 'msg-title', $defaults['msg-title'] ); |
|
| 54 | - $inst->set( 'username', $defaults['username'] ); |
|
| 55 | - $inst->set( 'password', $defaults['password'] ); |
|
| 52 | + $inst->set( 'list-title', $defaults[ 'list-title' ] ); |
|
| 53 | + $inst->set( 'msg-title', $defaults[ 'msg-title' ] ); |
|
| 54 | + $inst->set( 'username', $defaults[ 'username' ] ); |
|
| 55 | + $inst->set( 'password', $defaults[ 'password' ] ); |
|
| 56 | 56 | |
| 57 | 57 | // On-wiki values |
| 58 | 58 | try { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @return string |
| 73 | 73 | * @throws ConfigException |
| 74 | 74 | */ |
| 75 | - public function getWikiMessage( string $key ) : string { |
|
| 75 | + public function getWikiMessage ( string $key ) : string { |
|
| 76 | 76 | if ( $this->messages === null ) { |
| 77 | 77 | try { |
| 78 | 78 | $cont = $this->wiki->getPageContent( $this->opts[ 'msg-title' ] ); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | if ( !isset( $this->messages[ $key ] ) ) { |
| 85 | 85 | throw new ConfigException( "Message '$key' does not exist." ); |
| 86 | 86 | } |
| 87 | - return $this->messages[$key]; |
|
| 87 | + return $this->messages[ $key ]; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $key |
| 94 | 94 | * @param mixed $value |
| 95 | 95 | */ |
| 96 | - protected function set( string $key, $value ) : void { |
|
| 96 | + protected function set ( string $key, $value ) : void { |
|
| 97 | 97 | $this->opts[ $key ] = $value; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @return self |
| 104 | 104 | * @throws ConfigException |
| 105 | 105 | */ |
| 106 | - public static function getInstance() : self { |
|
| 106 | + public static function getInstance () : self { |
|
| 107 | 107 | if ( !self::$instance ) { |
| 108 | 108 | throw new ConfigException( 'Config not yet initialized' ); |
| 109 | 109 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return mixed |
| 118 | 118 | * @throws ConfigException |
| 119 | 119 | */ |
| 120 | - public function get( string $opt ) { |
|
| 120 | + public function get ( string $opt ) { |
|
| 121 | 121 | if ( !isset( $this->opts[ $opt ] ) ) { |
| 122 | 122 | throw new ConfigException( "Config option '$opt' not set." ); |
| 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\Request; |
| 4 | 4 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @inheritDoc |
| 11 | 11 | */ |
| 12 | - protected function reallyMakeRequest( string $params ) : string { |
|
| 12 | + protected function reallyMakeRequest ( string $params ) : string { |
|
| 13 | 13 | $context = [ |
| 14 | 14 | 'http' => [ |
| 15 | 15 | 'method' => $this->method, |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | ]; |
| 19 | 19 | $url = $this->url; |
| 20 | 20 | if ( $this->method === self::METHOD_POST ) { |
| 21 | - $context['http']['content'] = $params; |
|
| 21 | + $context[ 'http' ][ 'content' ] = $params; |
|
| 22 | 22 | } else { |
| 23 | 23 | $url = "$url?$params"; |
| 24 | 24 | } |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | foreach ( $http_response_header as $header ) { |
| 29 | 29 | $bits = explode( ':', $header, 2 ); |
| 30 | - if ( trim( $bits[0] ) === 'Set-Cookie' ) { |
|
| 31 | - $this->newCookies[] = $bits[1]; |
|
| 30 | + if ( trim( $bits[ 0 ] ) === 'Set-Cookie' ) { |
|
| 31 | + $this->newCookies[ ] = $bits[ 1 ]; |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare( strict_types=1 ); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace BotRiconferme\Request; |
| 4 | 4 | |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | /** @var string */ |
| 34 | 34 | protected $method = self::METHOD_GET; |
| 35 | 35 | /** @var string[] */ |
| 36 | - protected $newCookies = []; |
|
| 36 | + protected $newCookies = [ ]; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Use self::newFromParams, which will provide the right class to use |
| 40 | 40 | * |
| 41 | 41 | * @param array $params |
| 42 | 42 | */ |
| 43 | - protected function __construct( array $params ) { |
|
| 43 | + protected function __construct ( array $params ) { |
|
| 44 | 44 | $this->params = [ 'format' => 'json' ] + $params; |
| 45 | 45 | $this->url = DEFAULT_URL; |
| 46 | 46 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param array $params |
| 52 | 52 | * @return self |
| 53 | 53 | */ |
| 54 | - public static function newFromParams( array $params ) : self { |
|
| 54 | + public static function newFromParams ( array $params ) : self { |
|
| 55 | 55 | if ( extension_loaded( 'curl' ) ) { |
| 56 | 56 | $ret = new CurlRequest( $params ); |
| 57 | 57 | } else { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return self For chaining |
| 67 | 67 | */ |
| 68 | - public function setPost() : self { |
|
| 68 | + public function setPost () : self { |
|
| 69 | 69 | $this->method = self::METHOD_POST; |
| 70 | 70 | return $this; |
| 71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param string $url |
| 77 | 77 | * @return self for chaining |
| 78 | 78 | */ |
| 79 | - public function setUrl( string $url ) : self { |
|
| 79 | + public function setUrl ( string $url ) : self { |
|
| 80 | 80 | $this->url = $url; |
| 81 | 81 | return $this; |
| 82 | 82 | } |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | * @todo Return an iterable object which automatically continues the query only if the last |
| 89 | 89 | * entry available is reached. |
| 90 | 90 | */ |
| 91 | - public function execute() : \stdClass { |
|
| 91 | + public function execute () : \stdClass { |
|
| 92 | 92 | $curParams = $this->params; |
| 93 | - $sets = []; |
|
| 93 | + $sets = [ ]; |
|
| 94 | 94 | do { |
| 95 | 95 | $res = $this->makeRequestInternal( $curParams ); |
| 96 | 96 | |
| 97 | 97 | $this->handleErrorAndWarnings( $res ); |
| 98 | - $sets[] = $res; |
|
| 98 | + $sets[ ] = $res; |
|
| 99 | 99 | |
| 100 | 100 | $finished = true; |
| 101 | 101 | if ( isset( $res->continue ) ) { |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | * @param array $params |
| 114 | 114 | * @return \stdClass |
| 115 | 115 | */ |
| 116 | - private function makeRequestInternal( array $params ) : \stdClass { |
|
| 116 | + private function makeRequestInternal ( array $params ) : \stdClass { |
|
| 117 | 117 | if ( $this->method === self::METHOD_POST ) { |
| 118 | - $params['maxlag'] = self::MAXLAG; |
|
| 118 | + $params[ 'maxlag' ] = self::MAXLAG; |
|
| 119 | 119 | } |
| 120 | 120 | $query = http_build_query( $params ); |
| 121 | 121 | |
@@ -131,17 +131,17 @@ discard block |
||
| 131 | 131 | * @param string $params |
| 132 | 132 | * @return string |
| 133 | 133 | */ |
| 134 | - abstract protected function reallyMakeRequest( string $params ) : string; |
|
| 134 | + abstract protected function reallyMakeRequest ( string $params ) : string; |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * After a request, set cookies for the next ones |
| 138 | 138 | * |
| 139 | 139 | * @param array $cookies |
| 140 | 140 | */ |
| 141 | - protected function setCookies( array $cookies ) : void { |
|
| 141 | + protected function setCookies ( array $cookies ) : void { |
|
| 142 | 142 | foreach ( $cookies as $cookie ) { |
| 143 | 143 | $bits = explode( ';', $cookie ); |
| 144 | - [ $name, $value ] = explode( '=', $bits[0] ); |
|
| 144 | + [ $name, $value ] = explode( '=', $bits[ 0 ] ); |
|
| 145 | 145 | self::$cookiesToSet[ $name ] = $value; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @param \stdClass $res |
| 153 | 153 | * @return APIRequestException |
| 154 | 154 | */ |
| 155 | - private function getException( \stdClass $res ) : APIRequestException { |
|
| 155 | + private function getException ( \stdClass $res ) : APIRequestException { |
|
| 156 | 156 | switch ( $res->error->code ) { |
| 157 | 157 | case 'missingtitle': |
| 158 | 158 | $ex = new MissingPageException; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param \stdClass $res |
| 176 | 176 | * @throws APIRequestException |
| 177 | 177 | */ |
| 178 | - protected function handleErrorAndWarnings( \stdClass $res ) : void { |
|
| 178 | + protected function handleErrorAndWarnings ( \stdClass $res ) : void { |
|
| 179 | 179 | if ( isset( $res->error ) ) { |
| 180 | 180 | throw $this->getException( $res ); |
| 181 | 181 | } elseif ( isset( $res->warnings ) ) { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param \stdClass[] $sets |
| 192 | 192 | * @return \stdClass |
| 193 | 193 | */ |
| 194 | - private function mergeSets( array $sets ) : \stdClass { |
|
| 194 | + private function mergeSets ( array $sets ) : \stdClass { |
|
| 195 | 195 | // Use the first set as template |
| 196 | 196 | $ret = array_shift( $sets ); |
| 197 | 197 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * @param array|\stdClass $second |
| 209 | 209 | * @return array|\stdClass array |
| 210 | 210 | */ |
| 211 | - private function recursiveMerge( $first, $second ) { |
|
| 211 | + private function recursiveMerge ( $first, $second ) { |
|
| 212 | 212 | $ret = $first; |
| 213 | 213 | if ( is_array( $second ) ) { |
| 214 | 214 | $ret = is_array( $first ) ? array_merge_recursive( $first, $second ) : $second; |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @return array |
| 228 | 228 | */ |
| 229 | - protected function getHeaders() :array { |
|
| 229 | + protected function getHeaders () :array { |
|
| 230 | 230 | $ret = self::HEADERS; |
| 231 | 231 | if ( self::$cookiesToSet ) { |
| 232 | - $cookies = []; |
|
| 232 | + $cookies = [ ]; |
|
| 233 | 233 | foreach ( self::$cookiesToSet as $cname => $cval ) { |
| 234 | - $cookies[] = trim( "$cname=$cval" ); |
|
| 234 | + $cookies[ ] = trim( "$cname=$cval" ); |
|
| 235 | 235 | } |
| 236 | - $ret[] = 'Cookie: ' . implode( '; ', $cookies ); |
|
| 236 | + $ret[ ] = 'Cookie: ' . implode( '; ', $cookies ); |
|
| 237 | 237 | } |
| 238 | 238 | return $ret; |
| 239 | 239 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param array $headers |
| 245 | 245 | * @return string |
| 246 | 246 | */ |
| 247 | - protected function buildHeadersString( array $headers ) : string { |
|
| 247 | + protected function buildHeadersString ( array $headers ) : string { |
|
| 248 | 248 | $ret = ''; |
| 249 | 249 | foreach ( $headers as $header ) { |
| 250 | 250 | $ret .= "$header\r\n"; |