Skip to content

Commit b8c4417

Browse files
committed
Formatting and code cleanup
1 parent 0a19684 commit b8c4417

File tree

9 files changed

+23
-27
lines changed

9 files changed

+23
-27
lines changed

src/Api/Graph/Support/FieldtypeRegistrar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ public function registerField(ChannelField $field)
107107
return $this->types[$field->field_name];
108108
}
109109

110-
if (!$fieldtype instanceof GeneratesGraphType) {
110+
if (! $fieldtype instanceof GeneratesGraphType) {
111111
return null;
112112
}
113113

114114
$name = "Field__{$field->field_name}";
115115
$typeDefinition = $fieldtype->generateGraphType($field);
116116

117-
if(!$typeDefinition instanceof GraphQLType) {
118-
throw new \Exception("Generated GraphQL Type for field {$field->field_name} must extend ".GraphQLType::class.".");
117+
if (! $typeDefinition instanceof GraphQLType) {
118+
throw new \Exception("Generated GraphQL Type for field {$field->field_name} must extend ".GraphQLType::class.'.');
119119
}
120120

121121
$typeDefinition->name = $name;

src/Bootstrap/LoadExpressionEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function cli()
6767
// fake SERVER vars for CLI context
6868
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
6969
$this->constants['REQ'] = 'CLI';
70-
$this->constants['EE_INSTALLED'] = file_exists($this->constants['SYSPATH'] . 'user/config/config.php');
70+
$this->constants['EE_INSTALLED'] = file_exists($this->constants['SYSPATH'].'user/config/config.php');
7171

7272
return $this;
7373
}

src/Commands/EECliCommand.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@
77

88
class EECliCommand extends Command
99
{
10-
1110
use CanAccessRestrictedClass;
1211

1312
public $signature = 'eecli {args?*}';
1413

15-
public $description = "Run ExpressionEngine commands through Coilpack";
14+
public $description = 'Run ExpressionEngine commands through Coilpack';
1615

1716
private $cli;
1817

1918
public function __construct()
2019
{
2120
parent::__construct();
2221

23-
if(($_SERVER['argv'][1] ?? '') != 'eecli') {
22+
if (($_SERVER['argv'][1] ?? '') != 'eecli') {
2423
return;
2524
}
2625

@@ -29,10 +28,10 @@ public function __construct()
2928

3029
$this->setupCommand($_SERVER['argv'][2] ?? 'list');
3130

32-
foreach($_SERVER['argv'] as $arg) {
31+
foreach ($_SERVER['argv'] as $arg) {
3332
// If we have a help flag we need to get out early so that it can be
3433
// handled by the ExpressionEngine Command and not by Symfony/Laravel
35-
if($arg == '--help') {
34+
if ($arg == '--help') {
3635
return $this->handle();
3736
}
3837
}
@@ -42,7 +41,7 @@ protected function setupCommand($command)
4241
{
4342
$availableCommands = $this->callRestrictedMethod($this->cli, 'availableCommands');
4443

45-
if (!array_key_exists($command, $availableCommands)) {
44+
if (! array_key_exists($command, $availableCommands)) {
4645
exit("Command '$command' not found.");
4746
}
4847

@@ -61,23 +60,22 @@ protected function setupCommand($command)
6160
$this->callRestrictedMethod($commandClass, 'loadOptions');
6261
// Convert ExpressionEngine Command's option syntax into Laravel's and update the signature
6362
$options = $this->getRestrictedProperty($commandClass, 'commandOptions');
64-
$this->signature = $this->signature . ' ' . implode(' ', array_map(function($option) {
65-
if(strpos($option, 'verbose') !== false) {
63+
$this->signature = $this->signature.' '.implode(' ', array_map(function ($option) {
64+
if (strpos($option, 'verbose') !== false) {
6665
return '';
6766
}
6867

6968
$pieces = explode(',', $option);
70-
if(count($pieces) == 2) {
71-
$option = substr($pieces[1], 0, 1) . '|' . $pieces[0];
69+
if (count($pieces) == 2) {
70+
$option = substr($pieces[1], 0, 1).'|'.$pieces[0];
7271
}
73-
return "{--".$option."=}";
72+
73+
return '{--'.$option.'=}';
7474
}, array_keys($options)));
7575
}
7676

77-
7877
public function handle(): int
7978
{
8079
return $this->cli->process();
8180
}
82-
8381
}

src/Core.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class Core
66
{
7-
87
use Traits\CanAccessRestrictedClass;
98

109
protected $core;

src/Fieldtypes/Generic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function apply(FieldContent $content, array $parameters = [])
6161
$data = $content->getAttribute('data');
6262

6363
// Run pre_process if it exists
64-
if(method_exists($handler, 'pre_process')) {
64+
if (method_exists($handler, 'pre_process')) {
6565
$data = $handler->pre_process($data);
6666
}
6767

src/Fieldtypes/Modifiers/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public function handle(FieldtypeOutput $content, $parameters = [])
2222
$modified = (is_array($modified) && count($modified) === 1 && is_array(current($modified))) ? $modified[0] : $modified;
2323

2424
// If a manipulation fails and returns a boolean we fallback to the original url
25-
if(is_bool($modified)) {
25+
if (is_bool($modified)) {
2626
$modified = [
27-
'url' => $data['url'] ?? ''
27+
'url' => $data['url'] ?? '',
2828
];
2929
}
3030

src/Traits/CanAccessRestrictedClass.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Expressionengine\Coilpack\Traits;
44

5-
trait CanAccessRestrictedClass {
6-
5+
trait CanAccessRestrictedClass
6+
{
77
protected function getRestrictedProperty($object, $property)
88
{
99
$reflection = new \ReflectionClass($object);
@@ -28,5 +28,4 @@ public function callRestrictedMethod($object, $method, $parameters = [])
2828

2929
return $method->invoke($object, ...$parameters);
3030
}
31-
32-
}
31+
}

src/View/ModelTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Expressionengine\Coilpack\View;
44

5-
use Expressionengine\Coilpack\Support\Parameter;
65
use Expressionengine\Coilpack\Support\Arguments\ListArgument;
6+
use Expressionengine\Coilpack\Support\Parameter;
77

88
abstract class ModelTag extends IterableTag
99
{

src/View/Tags/Channel/Entries.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function getWithArgument($value)
194194
{
195195
// If the 'data' relation is requested we will append 'channel' and 'hiddenFields'
196196
// because these are necessary for properly displaying custom field data
197-
if(in_array('data', explode('|', $value))) {
197+
if (in_array('data', explode('|', $value))) {
198198
$value .= '|channel|hiddenFields';
199199
}
200200

0 commit comments

Comments
 (0)