Skip to content

Commit 66abd20

Browse files
committed
Convert spaces to tabs
1 parent 294134e commit 66abd20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2100
-1839
lines changed

.editorconfig

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# This file is for unifying the coding style for different editors and IDEs
22
# editorconfig.org
33

4+
# PHP PSR-12 Coding Standards
5+
# https://www.php-fig.org/psr/psr-12/
6+
7+
root = true
8+
49
[*]
510
charset = utf-8
6-
indent_style = space
7-
indent_size = 2
811
end_of_line = lf
9-
insert_final_newline = true
12+
indent_style = tab
13+
indent_size = 2
1014
trim_trailing_whitespace = true
1115

1216
[*.php]
1317
indent_size = 4
18+
insert_final_newline = true
1419

15-
[*.md,*.txt]
16-
trim_trailing_whitespace = false
17-
insert_final_newline = false
20+
[*.yml]
21+
indent_style = space
1822

19-
[composer.json]
20-
indent_size = 4
23+
[*.md]
24+
trim_trailing_whitespace = false

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@
5656
'whitespace_after_comma_in_array' => true
5757
])
5858
->setRiskyAllowed(true)
59+
->setIndent("\t")
5960
->setFinder($finder);

composer.json

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
11
{
2-
"name": "getkirby/kql",
3-
"description": "Kirby Query Language",
4-
"license": "MIT",
5-
"keywords": ["kirby", "cms", "api", "json", "query", "headless"],
6-
"homepage": "https://getkirby.com",
7-
"type": "kirby-plugin",
8-
"version": "1.1.0",
9-
"authors": [
10-
{
11-
"name": "Bastian Allgeier",
12-
"email": "bastian@getkirby.com"
13-
}
14-
],
15-
"require": {
16-
"getkirby/composer-installer": "^1.2.1"
17-
},
18-
"config": {
19-
"optimize-autoloader": true
20-
},
21-
"autoload": {
22-
"psr-4": {
23-
"Kirby\\": "src/"
24-
}
25-
},
26-
"scripts": {
27-
"fix": "php-cs-fixer fix"
28-
}
2+
"name": "getkirby/kql",
3+
"description": "Kirby Query Language",
4+
"license": "MIT",
5+
"keywords": [
6+
"kirby",
7+
"cms",
8+
"api",
9+
"json",
10+
"query",
11+
"headless"
12+
],
13+
"homepage": "https://getkirby.com",
14+
"type": "kirby-plugin",
15+
"version": "1.1.0",
16+
"authors": [
17+
{
18+
"name": "Bastian Allgeier",
19+
"email": "bastian@getkirby.com"
20+
}
21+
],
22+
"require": {
23+
"getkirby/composer-installer": "^1.2.1"
24+
},
25+
"config": {
26+
"optimize-autoloader": true,
27+
"allow-plugins": {
28+
"getkirby/composer-installer": false
29+
}
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"Kirby\\": "src/"
34+
}
35+
},
36+
"scripts": {
37+
"fix": "php-cs-fixer fix"
38+
}
2939
}

composer.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ class_alias('Kirby\Kql\Kql', 'Kql');
66

77
function kql($input, $model = null)
88
{
9-
return Kql::run($input, $model);
9+
return Kql::run($input, $model);
1010
}
1111

1212
Kirby::plugin('getkirby/kql', [
13-
'api' => [
14-
'routes' => function ($kirby) {
15-
return [
16-
[
17-
'pattern' => 'query',
18-
'method' => 'POST|GET',
19-
'auth' => $kirby->option('kql.auth') === false ? false : true,
20-
'action' => function () {
21-
$result = Kql::run(get());
13+
'api' => [
14+
'routes' => function ($kirby) {
15+
return [
16+
[
17+
'pattern' => 'query',
18+
'method' => 'POST|GET',
19+
'auth' => $kirby->option('kql.auth') === false ? false : true,
20+
'action' => function () {
21+
$result = Kql::run(get());
2222

23-
return [
24-
'code' => 200,
25-
'result' => $result,
26-
'status' => 'ok',
27-
];
28-
}
29-
]
30-
];
31-
}
32-
]
23+
return [
24+
'code' => 200,
25+
'result' => $result,
26+
'status' => 'ok',
27+
];
28+
}
29+
]
30+
];
31+
}
32+
]
3333
]);

src/Kql/Help.php

Lines changed: 101 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -6,105 +6,105 @@
66

77
class Help
88
{
9-
public static function for($object)
10-
{
11-
if (is_array($object) === true) {
12-
return static::forArray($object);
13-
}
14-
15-
if (is_object($object) === true) {
16-
return static::forObject($object);
17-
}
18-
19-
return [
20-
'type' => gettype($object),
21-
'value' => $object
22-
];
23-
}
24-
25-
public static function forArray(array $array)
26-
{
27-
return [
28-
'type' => 'array',
29-
'keys' => array_keys($array),
30-
];
31-
}
32-
33-
public static function forMethod($object, $method)
34-
{
35-
$reflection = new ReflectionMethod($object, $method);
36-
$returns = null;
37-
$params = [];
38-
39-
if ($returnType = $reflection->getReturnType()) {
40-
$returns = $returnType->getName();
41-
}
42-
43-
foreach ($reflection->getParameters() as $param) {
44-
$p = [
45-
'name' => $param->getName(),
46-
'required' => $param->isOptional() === false,
47-
'type' => $param->hasType() ? $param->getType()->getName() : null,
48-
];
49-
50-
if ($param->isDefaultValueAvailable()) {
51-
$p['default'] = $param->getDefaultValue();
52-
}
53-
54-
$call = null;
55-
56-
if ($p['type'] !== null) {
57-
$call = $p['type'] . ' ';
58-
}
59-
60-
$call .= '$' . $p['name'];
61-
62-
if ($p['required'] === false && isset($p['default']) === true) {
63-
$call .= ' = ' . var_export($p['default'], true);
64-
}
65-
66-
$p['call'] = $call;
67-
68-
$params[$p['name']] = $p;
69-
}
70-
71-
$call = '.' . $method;
72-
73-
if (empty($params) === false) {
74-
$call .= '(' . implode(', ', array_column($params, 'call')) . ')';
75-
}
76-
77-
return [
78-
'call' => $call,
79-
'name' => $method,
80-
'params' => $params,
81-
'returns' => $returns
82-
];
83-
}
84-
85-
public static function forMethods($object, $methods)
86-
{
87-
$methods = array_unique($methods);
88-
$reflection = [];
89-
90-
sort($methods);
91-
92-
foreach ($methods as $methodName) {
93-
if (method_exists($object, $methodName) === false) {
94-
continue;
95-
}
96-
97-
$reflection[$methodName] = static::forMethod($object, $methodName);
98-
}
99-
100-
return $reflection;
101-
}
102-
103-
public static function forObject($object)
104-
{
105-
$original = $object;
106-
$object = Interceptor::replace($original);
107-
108-
return $object->__debugInfo();
109-
}
9+
public static function for($object)
10+
{
11+
if (is_array($object) === true) {
12+
return static::forArray($object);
13+
}
14+
15+
if (is_object($object) === true) {
16+
return static::forObject($object);
17+
}
18+
19+
return [
20+
'type' => gettype($object),
21+
'value' => $object
22+
];
23+
}
24+
25+
public static function forArray(array $array)
26+
{
27+
return [
28+
'type' => 'array',
29+
'keys' => array_keys($array),
30+
];
31+
}
32+
33+
public static function forMethod($object, $method)
34+
{
35+
$reflection = new ReflectionMethod($object, $method);
36+
$returns = null;
37+
$params = [];
38+
39+
if ($returnType = $reflection->getReturnType()) {
40+
$returns = $returnType->getName();
41+
}
42+
43+
foreach ($reflection->getParameters() as $param) {
44+
$p = [
45+
'name' => $param->getName(),
46+
'required' => $param->isOptional() === false,
47+
'type' => $param->hasType() ? $param->getType()->getName() : null,
48+
];
49+
50+
if ($param->isDefaultValueAvailable()) {
51+
$p['default'] = $param->getDefaultValue();
52+
}
53+
54+
$call = null;
55+
56+
if ($p['type'] !== null) {
57+
$call = $p['type'] . ' ';
58+
}
59+
60+
$call .= '$' . $p['name'];
61+
62+
if ($p['required'] === false && isset($p['default']) === true) {
63+
$call .= ' = ' . var_export($p['default'], true);
64+
}
65+
66+
$p['call'] = $call;
67+
68+
$params[$p['name']] = $p;
69+
}
70+
71+
$call = '.' . $method;
72+
73+
if (empty($params) === false) {
74+
$call .= '(' . implode(', ', array_column($params, 'call')) . ')';
75+
}
76+
77+
return [
78+
'call' => $call,
79+
'name' => $method,
80+
'params' => $params,
81+
'returns' => $returns
82+
];
83+
}
84+
85+
public static function forMethods($object, $methods)
86+
{
87+
$methods = array_unique($methods);
88+
$reflection = [];
89+
90+
sort($methods);
91+
92+
foreach ($methods as $methodName) {
93+
if (method_exists($object, $methodName) === false) {
94+
continue;
95+
}
96+
97+
$reflection[$methodName] = static::forMethod($object, $methodName);
98+
}
99+
100+
return $reflection;
101+
}
102+
103+
public static function forObject($object)
104+
{
105+
$original = $object;
106+
$object = Interceptor::replace($original);
107+
108+
return $object->__debugInfo();
109+
}
110110
}

0 commit comments

Comments
 (0)