Skip to content

Commit e00c828

Browse files
committed
Correction in Methods and Spellings
1 parent 9d4ad84 commit e00c828

File tree

15 files changed

+49
-45
lines changed

15 files changed

+49
-45
lines changed

system/CodeIgniter.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function initialize()
199199
* @param \CodeIgniter\Router\RouteCollectionInterface $routes
200200
* @param boolean $returnResponse
201201
*
202-
* @throws \CodeIgniter\HTTP\RedirectException
202+
* @throws \CodeIgniter\Filters\Exceptions\FilterException
203203
* @throws \Exception
204204
*/
205205
public function run(RouteCollectionInterface $routes = null, bool $returnResponse = false)
@@ -234,7 +234,7 @@ public function run(RouteCollectionInterface $routes = null, bool $returnRespons
234234
{
235235
return $this->handleRequest($routes, $cacheConfig, $returnResponse);
236236
}
237-
catch (Router\RedirectException $e)
237+
catch (\CodeIgniter\Filters\Exceptions\FilterException $e)
238238
{
239239
$logger = Services::logger();
240240
$logger->info('REDIRECTED ROUTE at ' . $e->getMessage());
@@ -280,7 +280,7 @@ public function useSafeOutput(bool $safe = true)
280280
* @return \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\Response|\CodeIgniter\HTTP\ResponseInterface|mixed
281281
* @throws \CodeIgniter\Filters\Exceptions\FilterException
282282
*/
283-
protected function handleRequest(RouteCollectionInterface $routes = null, $cacheConfig, bool $returnResponse = false)
283+
protected function handleRequest(RouteCollectionInterface $routes, $cacheConfig, bool $returnResponse = false)
284284
{
285285
$routeFilter = $this->tryToRouteIt($routes);
286286

@@ -533,7 +533,7 @@ protected function forceSecureAccess($duration = 31536000)
533533
*
534534
* @throws \Exception
535535
*
536-
* @return boolean
536+
* @return bool|\CodeIgniter\HTTP\ResponseInterface
537537
*/
538538
public function displayCache($config)
539539
{
@@ -564,7 +564,9 @@ public function displayCache($config)
564564
$this->response->setBody($output);
565565

566566
return $this->response;
567-
};
567+
}
568+
569+
return false;
568570
}
569571

570572
//--------------------------------------------------------------------
@@ -574,7 +576,7 @@ public function displayCache($config)
574576
*
575577
* @param integer $time
576578
*
577-
* @return $this
579+
* @return void
578580
*/
579581
public static function cache(int $time)
580582
{
@@ -683,7 +685,7 @@ public function displayPerformanceMetrics(string $output): string
683685
*
684686
* @return string
685687
*/
686-
protected function tryToRouteIt(RouteCollectionInterface $routes = null)
688+
protected function tryToRouteIt(RouteCollectionInterface $routes)
687689
{
688690
if (empty($routes) || ! $routes instanceof RouteCollectionInterface)
689691
{

system/Controller.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Controller
106106
* @param ResponseInterface $response
107107
* @param \Psr\Log\LoggerInterface $logger
108108
*
109-
* @throws \CodeIgniter\HTTP\RedirectException
109+
* @throws \CodeIgniter\HTTP\Exceptions\HTTPException
110110
*/
111111
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
112112
{
@@ -135,7 +135,7 @@ public function initController(RequestInterface $request, ResponseInterface $res
135135
* considered secure for. Only with HSTS header.
136136
* Default value is 1 year.
137137
*
138-
* @throws \CodeIgniter\HTTP\RedirectException
138+
* @throws \CodeIgniter\HTTP\Exceptions\HTTPException
139139
*/
140140
public function forceHTTPS(int $duration = 31536000)
141141
{
@@ -179,14 +179,14 @@ protected function loadHelpers()
179179
* A shortcut to performing validation on input data. If validation
180180
* is not successful, a $errors property will be set on this class.
181181
*
182-
* @param array $rules
183-
* @param array $messages An array of custom error messages
182+
* @param array|string $rules
183+
* @param array $messages An array of custom error messages
184184
*
185185
* @return boolean
186186
*/
187187
public function validate($rules, array $messages = []): bool
188188
{
189-
$this->validator = Services::validation();
189+
$this->validator = \Config\Services::validation();
190190

191191
// If you replace the $rules array with the name of the group
192192
if (is_string($rules))
@@ -211,9 +211,8 @@ public function validate($rules, array $messages = []): bool
211211
}
212212

213213
$success = $this->validator
214-
->withRequest($this->request)
215214
->setRules($rules, $messages)
216-
->run();
215+
->run($this->request->getPost());
217216

218217
return $success;
219218
}

system/Entity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ private function castAsJson($value, bool $asArray = false)
566566

567567
if (json_last_error() !== JSON_ERROR_NONE)
568568
{
569-
throw CastException::forInvalidJsonFormatException(json_last_error());
569+
throw \CodeIgniter\Exceptions\CastException::forInvalidJsonFormatException(json_last_error());
570570
}
571571
}
572572
}

system/HTTP/Header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getName()
9191

9292
/**
9393
* Gets the raw value of the header. This may return either a string
94-
* of an array, depending on whether the header has mutliple values or not.
94+
* of an array, depending on whether the header has multiple values or not.
9595
*
9696
* @return array|null|string
9797
*/

system/HTTP/IncomingRequest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,19 @@ class IncomingRequest extends Request
152152
* @param string $body
153153
* @param \CodeIgniter\HTTP\UserAgent $userAgent
154154
*/
155-
public function __construct($config, $uri = null, $body = 'php://input', UserAgent $userAgent)
155+
public function __construct($config, $uri = null, $body = 'php://input', UserAgent $userAgent = null)
156156
{
157157
// Get our body from php://input
158158
if ($body === 'php://input')
159159
{
160160
$body = file_get_contents('php://input');
161161
}
162162

163+
if($userAgent === null)
164+
{
165+
$userAgent = new \CodeIgniter\HTTP\UserAgent();
166+
}
167+
163168
$this->body = $body;
164169
$this->config = $config;
165170
$this->userAgent = $userAgent;

system/Model.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,6 @@ public function find($id = null)
343343
$this->tempReturnType = $this->returnType;
344344
$this->tempUseSoftDeletes = $this->useSoftDeletes;
345345

346-
$this->reset();
347-
348346
return $row['data'];
349347
}
350348

system/Router/RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class RouteCollection implements RouteCollectionInterface
223223
* Constructor
224224
*
225225
* @param FileLocator $locator
226-
* @param Config/Modules $moduleConfig
226+
* @param \Config\Modules $moduleConfig
227227
*/
228228
public function __construct(FileLocator $locator, $moduleConfig)
229229
{

system/Session/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Session implements SessionInterface
5252
/**
5353
* Instance of the driver to use.
5454
*
55-
* @var HandlerInterface
55+
* @var \CodeIgniter\Log\Handlers\HandlerInterface
5656
*/
5757
protected $driver;
5858

system/Test/ControllerTester.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function controller(string $name)
109109
* @param string $method
110110
* @param array $params
111111
*
112-
* @return \CodeIgniter\TestControllerResponse
112+
* @return \CodeIgniter\Test\ControllerResponse|\InvalidArgumentException
113113
*/
114114
public function execute(string $method, ...$params)
115115
{

system/Validation/FormatRules.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function numeric(string $str = null): bool
196196
*
197197
* @return boolean
198198
*/
199-
public function regex_match(string $str = null, string $pattern, array $data): bool
199+
public function regex_match(string $str, string $pattern, array $data): bool
200200
{
201201
if (strpos($pattern, '/') !== 0)
202202
{
@@ -320,7 +320,7 @@ public function valid_emails(string $str = null): bool
320320
*
321321
* @return boolean
322322
*/
323-
public function valid_ip(string $ip = null, string $which = null, array $data): bool
323+
public function valid_ip(string $ip, string $which, array $data): bool
324324
{
325325
switch (strtolower($which))
326326
{

0 commit comments

Comments
 (0)