Skip to content

Commit db45a3e

Browse files
authored
Merge pull request #590 from z-song/analysis-z33ORY
Apply fixes from StyleCI
2 parents cb60702 + 9896ada commit db45a3e

15 files changed

+46
-46
lines changed

src/Controllers/AuthController.php

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function postLogin(Request $request)
4747
}
4848

4949
if (Auth::guard('admin')->attempt($credentials)) {
50-
5150
admin_toastr(trans('admin::lang.login_successful'));
5251

5352
return redirect()->intended(config('admin.prefix'));

src/Form.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,12 @@ protected function handleEditable(array $input = [])
559559

560560
/**
561561
* @param array $input
562+
*
562563
* @return array
563564
*/
564565
protected function handleFileDelete(array $input = [])
565566
{
566-
if (array_key_exists(Field::FILE_DELETE_FLAG , $input)) {
567+
if (array_key_exists(Field::FILE_DELETE_FLAG, $input)) {
567568
$input[Field::FILE_DELETE_FLAG] = $input['key'];
568569
unset($input['key']);
569570
}

src/Form/Builder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public function options($options = [])
292292
* Get or set option.
293293
*
294294
* @param string $option
295-
* @param mixed $value
295+
* @param mixed $value
296296
*
297297
* @return $this
298298
*/

src/Form/Field.php

+16-18
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ protected function formatAttributes()
660660
*/
661661
public function setElementClass($class)
662662
{
663-
$this->elementClass = (array)$class;
663+
$this->elementClass = (array) $class;
664664

665665
return $this;
666666
}
@@ -675,14 +675,14 @@ protected function getElementClass()
675675
if (!$this->elementClass) {
676676
$name = $this->elementName ?: $this->formatName($this->column);
677677

678-
$this->elementClass = (array)str_replace(['[', ']'], '_', $name);
678+
$this->elementClass = (array) str_replace(['[', ']'], '_', $name);
679679
}
680680

681681
return $this->elementClass;
682682
}
683683

684684
/**
685-
* Get element class string
685+
* Get element class string.
686686
*
687687
* @return mixed
688688
*/
@@ -698,7 +698,7 @@ protected function getElementClassString()
698698
}
699699

700700
/**
701-
* Get element class selector
701+
* Get element class selector.
702702
*
703703
* @return string
704704
*/
@@ -707,60 +707,58 @@ protected function getElementClassSelector()
707707
$elementClass = $this->getElementClass();
708708

709709
if (Arr::isAssoc($elementClass)) {
710-
711710
$classes = [];
712711

713712
foreach ($elementClass as $index => $class) {
714-
$classes[$index] = '.' . $class;
713+
$classes[$index] = '.'.$class;
715714
}
716715

717716
return $classes;
718717
}
719718

720-
return '.' . implode('.', $elementClass);
719+
return '.'.implode('.', $elementClass);
721720
}
722721

723722
/**
724-
* Add the element class
723+
* Add the element class.
725724
*
726725
* @param $class
726+
*
727727
* @return $this
728728
*/
729729
public function addElementClass($class)
730730
{
731-
if(is_array($class) || is_string($class)){
732-
733-
$this->elementClass = array_merge($this->elementClass, (array)$class);
731+
if (is_array($class) || is_string($class)) {
732+
$this->elementClass = array_merge($this->elementClass, (array) $class);
734733

735734
$this->elementClass = array_unique($this->elementClass);
736735
}
737736

738737
return $this;
739738
}
740739

741-
742740
/**
743-
* Remove element class
741+
* Remove element class.
744742
*
745743
* @param $class
744+
*
746745
* @return $this
747746
*/
748747
public function removeElementClass($class)
749748
{
750749
$delClass = [];
751750

752-
if(is_string($class) || is_array($class)){
753-
$delClass = (array)$class;
751+
if (is_string($class) || is_array($class)) {
752+
$delClass = (array) $class;
754753
}
755754

756-
foreach($delClass as $del){
757-
if(($key = array_search($del, $this->elementClass))){
755+
foreach ($delClass as $del) {
756+
if (($key = array_search($del, $this->elementClass))) {
758757
unset($this->elementClass[$key]);
759758
}
760759
}
761760

762761
return $this;
763-
764762
}
765763

766764
/**

src/Form/Field/File.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class File extends Field
3333
* Create a new File instance.
3434
*
3535
* @param string $column
36-
* @param array $arguments
36+
* @param array $arguments
3737
*/
3838
public function __construct($column, $arguments = [])
3939
{
@@ -57,7 +57,7 @@ public function defaultDirectory()
5757
*/
5858
public function getValidator(array $input)
5959
{
60-
/**
60+
/*
6161
* If has original value, means the form is in edit mode,
6262
* then remove required rule from rules.
6363
*/

src/Form/Field/MultipleFile.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MultipleFile extends Field
3333
* Create a new File instance.
3434
*
3535
* @param string $column
36-
* @param array $arguments
36+
* @param array $arguments
3737
*/
3838
public function __construct($column, $arguments = [])
3939
{
@@ -86,8 +86,8 @@ protected function hydrateFiles(array $value)
8686
$rules = $input = [];
8787

8888
foreach ($value as $key => $file) {
89-
$rules[$this->column . $key] = $this->getRules();
90-
$input[$this->column . $key] = $file;
89+
$rules[$this->column.$key] = $this->getRules();
90+
$input[$this->column.$key] = $file;
9191
}
9292

9393
return [$rules, $input];

src/Form/Field/MultipleImage.php

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Encore\Admin\Form\Field;
44

5-
65
use Symfony\Component\HttpFoundation\File\UploadedFile;
76

87
class MultipleImage extends MultipleFile

src/Form/Field/UploadField.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ protected function setupDefaultOptions()
6161
'browseLabel' => trans('admin::lang.browse'),
6262
'showRemove' => false,
6363
'showUpload' => false,
64-
'initialCaption' => $this->initialCaption($this->value),
65-
'deleteExtraData' => [
66-
$this->column => '',
64+
'initialCaption' => $this->initialCaption($this->value),
65+
'deleteExtraData' => [
66+
$this->column => '',
6767
static::FILE_DELETE_FLAG => '',
68-
'_token' => csrf_token(),
69-
'_method' => 'PUT'
70-
]
68+
'_token' => csrf_token(),
69+
'_method' => 'PUT',
70+
],
7171
];
7272

7373
if ($this->form instanceof Form) {
74-
$defaultOptions['deleteUrl'] = $this->form->resource() . '/'. $this->form->model()->getKey();
74+
$defaultOptions['deleteUrl'] = $this->form->resource().'/'.$this->form->model()->getKey();
7575
}
7676

7777
$this->options($defaultOptions);
@@ -130,7 +130,7 @@ public function disk($disk)
130130
/**
131131
* Specify the directory and name for upload file.
132132
*
133-
* @param string $directory
133+
* @param string $directory
134134
* @param null|string $name
135135
*
136136
* @return $this
@@ -239,7 +239,7 @@ protected function upload(UploadedFile $file)
239239
{
240240
$this->renameIfExists($file);
241241

242-
$target = $this->getDirectory() . '/' . $this->name;
242+
$target = $this->getDirectory().'/'.$this->name;
243243

244244
$this->storage->put($target, file_get_contents($file->getRealPath()));
245245

@@ -273,7 +273,7 @@ public function objectUrl($path)
273273
return $path;
274274
}
275275

276-
return rtrim(config('admin.upload.host'), '/') . '/' . trim($path, '/');
276+
return rtrim(config('admin.upload.host'), '/').'/'.trim($path, '/');
277277
}
278278

279279
/**

src/Form/Tools.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function backButton()
6868

6969
public function listButton()
7070
{
71-
$slice = Str::contains($this->form->getResource(0), "/edit") ? null : -1;
71+
$slice = Str::contains($this->form->getResource(0), '/edit') ? null : -1;
7272
$resource = $this->form->getResource($slice);
7373

7474
$text = trans('admin::lang.list');

src/Grid.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function column($name, $label = '')
269269

270270
$label = empty($label) ? ucfirst($relationColumn) : $label;
271271

272-
$name = snake_case($relationName) . '.' . $relationColumn;
272+
$name = snake_case($relationName).'.'.$relationColumn;
273273
}
274274

275275
$column = $this->addColumn($name, $label);

src/Grid/Column.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ public static function extend($name, $displayer)
124124
* Define a column globally.
125125
*
126126
* @param string $name
127-
*
128-
* @param mixed $definition
127+
* @param mixed $definition
129128
*/
130129
public static function define($name, $definition)
131130
{
@@ -335,7 +334,7 @@ protected function isDefinedColumn()
335334
}
336335

337336
/**
338-
* Use a defined column
337+
* Use a defined column.
339338
*
340339
* @throws \Exception
341340
*/
@@ -348,6 +347,7 @@ protected function useDefinedColumn()
348347

349348
if ($class instanceof Closure) {
350349
$this->display($class);
350+
351351
return;
352352
}
353353

src/Grid/Displayers/Editable.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function display()
138138
{
139139
$this->options['name'] = $column = $this->column->getName();
140140

141-
$class = 'grid-editable-' . str_replace(['.','#','[',']'], '-',$column);
141+
$class = 'grid-editable-'.str_replace(['.', '#', '[', ']'], '-', $column);
142142

143143
$this->buildEditableOptions(func_get_args());
144144

@@ -159,7 +159,7 @@ public function display()
159159
return "$name='$attribute'";
160160
})->implode(' ');
161161

162-
$html = $this->type === 'select' ? '' :$this->value;
162+
$html = $this->type === 'select' ? '' : $this->value;
163163

164164
return "<a $attributes>{$html}</a>";
165165
}

src/Layout/Column.php

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Column implements Buildable
1818

1919
/**
2020
* Column constructor.
21+
*
2122
* @param $content
2223
* @param int $width
2324
*/

src/Layout/Row.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Row implements Buildable
1111

1212
/**
1313
* Row constructor.
14+
*
1415
* @param string $content
1516
*/
1617
public function __construct($content = '')
@@ -23,7 +24,7 @@ public function __construct($content = '')
2324
/**
2425
* Add a column.
2526
*
26-
* @param int $width
27+
* @param int $width
2728
* @param $content
2829
*/
2930
public function column($width, $content)

src/helpers.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function admin_url($url = '')
3838
*
3939
* @param string $message
4040
* @param string $type
41-
* @param array $options
41+
* @param array $options
42+
*
4243
* @return string
4344
*/
4445
function admin_toastr($message = '', $type = 'success', $options = [])

0 commit comments

Comments
 (0)