Skip to content

Commit 2b3981b

Browse files
authored
Merge pull request #2165 from jim-parry/feature/resource
RESTful help
2 parents 4ae9694 + 139fdd4 commit 2b3981b

37 files changed

Lines changed: 1672 additions & 308 deletions

app/Controllers/BaseController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?php
2-
32
namespace App\Controllers;
43

5-
use CodeIgniter\Controller;
6-
74
/**
85
* Class BaseController
96
*
@@ -16,6 +13,9 @@
1613
*
1714
* @package CodeIgniter
1815
*/
16+
17+
use CodeIgniter\Controller;
18+
1919
class BaseController extends Controller
2020
{
2121

@@ -26,21 +26,21 @@ class BaseController extends Controller
2626
*
2727
* @var array
2828
*/
29-
protected $helpers = [ ];
29+
protected $helpers = [];
3030

3131
/**
3232
* Constructor.
33-
*
3433
*/
3534
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
3635
{
3736
// Do Not Edit This Line
3837
parent::initController($request, $response, $logger);
38+
3939
//--------------------------------------------------------------------
4040
// Preload any models, libraries, etc, here.
4141
//--------------------------------------------------------------------
4242
// E.g.:
4343
// $this->session = \Config\Services::session();
44-
4544
}
45+
4646
}

system/Cache/Handlers/MemcachedHandler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function initialize()
138138

139139
// $stats should be an associate array with a key in the format of host:port.
140140
// If it doesn't have the key, we know the server is not working as expected.
141-
if( !isset($stats[$this->config['host']. ':' .$this->config['port']]) )
141+
if (! isset($stats[$this->config['host'] . ':' . $this->config['port']]))
142142
{
143143
throw new CriticalError('Cache: Memcached connection failed.');
144144
}
@@ -154,7 +154,8 @@ public function initialize()
154154
);
155155

156156
// If we can't connect, throw a CriticalError exception
157-
if($can_connect == false){
157+
if ($can_connect === false)
158+
{
158159
throw new CriticalError('Cache: Memcache connection failed.');
159160
}
160161

system/Common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ function force_https(int $duration = 31536000, RequestInterface $request = null,
815815
$response->setHeader('Strict-Transport-Security', 'max-age=' . $duration);
816816
$response->redirect($uri);
817817
$response->sendHeaders();
818-
818+
819819
exit();
820820
}
821821
}

system/Config/Config.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ private static function createClass(string $name)
122122
{
123123
return new $name();
124124
}
125-
125+
126126
$locator = Services::locator();
127127
$file = $locator->locateFile($name, 'Config');
128-
128+
129129
if (empty($file))
130130
{
131131
// No file found - check if the class was namespaced
@@ -134,14 +134,14 @@ private static function createClass(string $name)
134134
// Class was namespaced and locateFile couldn't find it
135135
return null;
136136
}
137-
137+
138138
// Check all namespaces
139139
$files = $locator->search('Config/' . $name);
140140
if (empty($files))
141141
{
142142
return null;
143143
}
144-
144+
145145
// Get the first match (prioritizes user and framework)
146146
$file = reset($files);
147147
}

system/Debug/Toolbar/Views/toolbarloader.js.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ function loadDoc(time) {
6262

6363
// Track all AJAX requests
6464
if (window.ActiveXObject) {
65-
var oldXHR = new ActiveXObject('Microsoft.XMLHTTP');
65+
var oldXHR = new ActiveXObject('Microsoft.XMLHTTP');
6666
} else {
67-
var oldXHR = window.XMLHttpRequest;
67+
var oldXHR = window.XMLHttpRequest;
6868
}
6969

7070
function newXHR() {

system/Entity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ private function castAsJson($value, bool $asArray = false)
600600
$tmp = ! is_null($value) ? ($asArray ? [] : new \stdClass) : null;
601601
if (function_exists('json_decode'))
602602
{
603-
if ((is_string($value) && strlen($value) > 1 && in_array($value{0}, ['[','{','"'])) || is_numeric($value))
603+
if ((is_string($value) && strlen($value) > 1 && in_array($value{0}, ['[', '{', '"'])) || is_numeric($value))
604604
{
605605
$tmp = json_decode($value, $asArray);
606606

system/Exceptions/ModelException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static function forNoPrimaryKey(string $modelName)
1010
{
1111
return new static(lang('Database.noPrimaryKey', [$modelName]));
1212
}
13-
13+
1414
public static function forNoDateFormat(string $modelName)
1515
{
1616
return new static(lang('Database.noDateFormat', [$modelName]));

system/Files/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function getMimeType(): string
151151
public function getRandomName(): string
152152
{
153153
$extension = $this->getExtension();
154-
$extension = empty($extension) ? '' : '.' . $extension;
154+
$extension = empty($extension) ? '' : '.' . $extension;
155155
return time() . '_' . bin2hex(random_bytes(10)) . $extension;
156156
}
157157

@@ -204,7 +204,7 @@ public function getDestination(string $destination, string $delimiter = '_', int
204204
{
205205
while (is_file($destination))
206206
{
207-
$info = pathinfo($destination);
207+
$info = pathinfo($destination);
208208
$extension = isset($info['extension']) ? '.' . $info['extension'] : '';
209209
if (strpos($info['filename'], $delimiter) !== false)
210210
{

system/Helpers/date_helper.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,26 @@ function now(string $timezone = null): int
7777
*
7878
* Returns a string with the formatted HTML
7979
*
80-
* @param string $class Optional class to apply to the select field
81-
* @param string $default Default value for initial selection
82-
* @param int $what One of the DateTimeZone class constants (for listIdentifiers)
83-
* @param string $country A two-letter ISO 3166-1 compatible country code (for listIdentifiers)
80+
* @param string $class Optional class to apply to the select field
81+
* @param string $default Default value for initial selection
82+
* @param integer $what One of the DateTimeZone class constants (for listIdentifiers)
83+
* @param string $country A two-letter ISO 3166-1 compatible country code (for listIdentifiers)
8484
*
8585
* @return string
8686
* @throws \Exception
8787
*/
8888
function timezone_select(string $class = '', string $default = '', int $what = \DateTimeZone::ALL, string $country = null): string
8989
{
9090
$timezones = \DateTimeZone::listIdentifiers($what, $country);
91-
91+
9292
$buffer = "<select name='timezone' class='{$class}'>" . PHP_EOL;
9393
foreach ($timezones as $timezone)
9494
{
95-
$selected = ($timezone == $default) ? 'selected' : '';
96-
$buffer .= "<option value='{$timezone}' {$selected}>{$timezone}</option>" . PHP_EOL;
95+
$selected = ($timezone === $default) ? 'selected' : '';
96+
$buffer .= "<option value='{$timezone}' {$selected}>{$timezone}</option>" . PHP_EOL;
9797
}
98-
$buffer .= "</select>" . PHP_EOL;
99-
98+
$buffer .= '</select>' . PHP_EOL;
99+
100100
return $buffer;
101101
}
102102
}

system/Language/en/Entity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515

1616
return
1717
[
18-
'tryingToAccessNonExistentProperty' => 'Trying to access non existent property {0} of {1}'
18+
'tryingToAccessNonExistentProperty' => 'Trying to access non existent property {0} of {1}',
1919
];

0 commit comments

Comments
 (0)