Google Analytics.
@@ -72,6 +77,7 @@ protected function dependencyInstalled()
/**
* @param $dailyStats
+ *
* @return mixed
*/
protected function dateLabels($dailyStats)
@@ -91,9 +97,9 @@ protected function period()
return $this->dependencyInstalled()
? Period::create($start, $end)
- : (object)[
+ : (object) [
'startDate' => $start,
- 'endDate' => $end
+ 'endDate' => $end,
];
}
@@ -101,6 +107,7 @@ protected function period()
* Provide fake analytics data for demo purposes.
*
* @param $period
+ *
* @return \Illuminate\Support\Collection
*/
protected function fakeData($period)
diff --git a/src/Dashboard/Panels/MembersPanel.php b/src/Dashboard/Panels/MembersPanel.php
index 7f5f6ca..d936d08 100755
--- a/src/Dashboard/Panels/MembersPanel.php
+++ b/src/Dashboard/Panels/MembersPanel.php
@@ -16,10 +16,10 @@ public function render()
$weekAgo = \Carbon\Carbon::now()->subWeek();
$monthAgo = \Carbon\Carbon::now()->subMonth();
- $total = $this->createModel()->count();
- $signedLastWeek = $this->createModel()
+ $total = $this->createModel()->count();
+ $signedLastWeek = $this->createModel()
->where('created_at', '>=', $weekAgo)->count();
- $signedLastMonth = $this->createModel()
+ $signedLastMonth = $this->createModel()
->where('created_at', '>=', $monthAgo)->count();
$signedStatistics = $this->createModel()
->where('created_at', '>=', $monthAgo)
@@ -27,9 +27,9 @@ public function render()
->groupBy('dt')->pluck('cnt', 'dt');
return view(app('scaffold.template')->dashboard('members'), [
- 'total' => $total,
- 'signed' => [
- 'lastWeek' => $signedLastWeek,
+ 'total' => $total,
+ 'signed' => [
+ 'lastWeek' => $signedLastWeek,
'lastMonth' => $signedLastMonth,
],
'signedStatistics' => $signedStatistics,
@@ -41,6 +41,6 @@ public function render()
*/
protected function createModel()
{
- return (new User);
+ return new User();
}
}
diff --git a/src/Decorators/Grid.php b/src/Decorators/Grid.php
index 846f86e..7760528 100755
--- a/src/Decorators/Grid.php
+++ b/src/Decorators/Grid.php
@@ -2,18 +2,18 @@
namespace Terranet\Administrator\Decorators;
-use Terranet\Rankable\Rankable;
-use Illuminate\Database\Eloquent\Model;
-use Terranet\Translatable\Translatable;
-use Terranet\Administrator\Columns\Element;
use Czim\Paperclip\Contracts\AttachableInterface;
+use Illuminate\Database\Eloquent\Model;
+use Terranet\Administrator\Columns\Decorators\AttachmentDecorator;
+use Terranet\Administrator\Columns\Decorators\BooleanDecorator;
use Terranet\Administrator\Columns\Decorators\CellDecorator;
+use Terranet\Administrator\Columns\Decorators\DatetimeDecorator;
use Terranet\Administrator\Columns\Decorators\RankDecorator;
-use Terranet\Administrator\Columns\Decorators\TextDecorator;
use Terranet\Administrator\Columns\Decorators\StringDecorator;
-use Terranet\Administrator\Columns\Decorators\BooleanDecorator;
-use Terranet\Administrator\Columns\Decorators\DatetimeDecorator;
-use Terranet\Administrator\Columns\Decorators\AttachmentDecorator;
+use Terranet\Administrator\Columns\Decorators\TextDecorator;
+use Terranet\Administrator\Columns\Element;
+use Terranet\Rankable\Rankable;
+use Terranet\Translatable\Translatable;
class Grid
{
@@ -41,6 +41,7 @@ public function makeElement($element)
/**
* @param $column
+ *
* @return CellDecorator
*/
protected function getDecorator($column)
@@ -75,6 +76,7 @@ protected function getDecorator($column)
/**
* @param $column
+ *
* @return bool
*/
protected function realColum($column)
@@ -84,6 +86,7 @@ protected function realColum($column)
/**
* @param $column
+ *
* @return CellDecorator
*/
protected function decorateByType($column)
@@ -92,19 +95,19 @@ protected function decorateByType($column)
$this->fetchTablesColumns()[$column]->getType()
);
- if ($this->model instanceof Rankable && $column == $this->model->getRankableColumn()) {
+ if ($this->model instanceof Rankable && $column === $this->model->getRankableColumn()) {
return new RankDecorator($column);
}
- if (in_array($className, ['TimeType', 'DateType', 'DateTimeType'])) {
+ if (in_array($className, ['TimeType', 'DateType', 'DateTimeType'], true)) {
return (new DatetimeDecorator($column))->setType($className);
}
- if (in_array($className, ['BooleanType'])) {
+ if (in_array($className, ['BooleanType'], true)) {
return new BooleanDecorator($column);
}
- if (in_array($className, ['TextType'])) {
+ if (in_array($className, ['TextType'], true)) {
return new TextDecorator($column);
}
@@ -117,7 +120,8 @@ protected function decorateByType($column)
protected function fetchTablesColumns()
{
return \admin\db\table_columns(
- $this->model, true
+ $this->model,
+ true
);
}
-}
\ No newline at end of file
+}
diff --git a/src/Events/TranslationsChanged.php b/src/Events/TranslationsChanged.php
index 45a907d..32aeb1e 100644
--- a/src/Events/TranslationsChanged.php
+++ b/src/Events/TranslationsChanged.php
@@ -19,4 +19,4 @@ public function __construct(array $locales = [])
{
$this->locales = $locales;
}
-}
\ No newline at end of file
+}
diff --git a/src/Filter.php b/src/Filter.php
index df38c7c..5eb074f 100755
--- a/src/Filter.php
+++ b/src/Filter.php
@@ -21,7 +21,7 @@ class Filter implements FilterContract
/**
* Filters collection.
*
- * @var Collection|null
+ * @var null|Collection
*/
protected $filters;
@@ -48,7 +48,8 @@ public function __construct(Request $request, Mutable $filters = null, Mutable $
/**
* Set collection of filters.
*
- * @param Mutable|null $filters
+ * @param null|Mutable $filters
+ *
* @return mixed|void
*/
public function setFilters(Mutable $filters = null)
@@ -93,7 +94,7 @@ public function setScopes(Mutable $scopes = null)
/**
* Get all filters.
*
- * @return Collection|null
+ * @return null|Collection
*/
public function filters()
{
@@ -138,12 +139,13 @@ public function makeScopedUrl($scope = null)
* Check if filter has element with name.
*
* @param $name
+ *
* @return bool
*/
public function has($name)
{
foreach ($this->filters() as $filter) {
- if ($filter->id() == $name) {
+ if ($filter->id() === $name) {
return true;
}
}
diff --git a/src/Filters/Assembler.php b/src/Filters/Assembler.php
index 0e84644..d245e13 100755
--- a/src/Filters/Assembler.php
+++ b/src/Filters/Assembler.php
@@ -2,7 +2,6 @@
namespace Terranet\Administrator\Filters;
-use function admin\db\scheme;
use Closure;
use Exception;
use Illuminate\Database\Eloquent\Builder;
@@ -14,6 +13,7 @@
use Terranet\Administrator\Contracts\QueryBuilder;
use Terranet\Administrator\Form\FormElement;
use Terranet\Translatable\Translatable;
+use function admin\db\scheme;
class Assembler
{
@@ -34,7 +34,7 @@ public function __construct($eloquent)
{
if ($this->model = $eloquent) {
$this->query = $this->model->newQuery();
- $this->query->select($this->model->getTable() . '.*');
+ $this->query->select($this->model->getTable().'.*');
}
}
@@ -70,15 +70,17 @@ public function filters(Collection $filters)
* Apply scope.
*
* @param Scope $scope
- * @return $this
+ *
* @throws \Terranet\Administrator\Exception
+ *
+ * @return $this
*/
public function scope(Scope $scope)
{
$callable = $scope->getQuery();
if (is_string($callable)) {
- /**
+ /*
* Adds a Class "ClassName::class" syntax.
*
* @note In this case Query class should implement Contracts\Module\Queryable interface.
@@ -90,7 +92,7 @@ public function scope(Scope $scope)
if (!method_exists($object, 'query')) {
throw new \Terranet\Administrator\Exception(
sprintf(
- "Query object %s should implement %s interface",
+ 'Query object %s should implement %s interface',
get_class($object),
\Terranet\Administrator\Contracts\Module\Queryable::class
)
@@ -102,13 +104,13 @@ public function scope(Scope $scope)
return $this;
}
- /**
+ /*
* Allows "SomeClass@method" syntax.
*
* @example: (new Scope('name'))->addQuery("User@active")
*/
if (str_contains($callable, '@')) {
- list($object, $method) = explode("@", $callable);
+ list($object, $method) = explode('@', $callable);
$this->query = app($object)->$method($this->query);
@@ -116,7 +118,7 @@ public function scope(Scope $scope)
}
}
- /**
+ /*
* Allows adding a \Closure as a query;
*
* @example: (new Scope('name'))->setQuery(function($query) { return $this->modify(); })
@@ -127,7 +129,7 @@ public function scope(Scope $scope)
return $this;
}
- /**
+ /*
* Accepts callable builder
*
* @example: (new Scope('name'))->setQuery([SomeClass::class, "queryMethod"]);
@@ -139,10 +141,10 @@ public function scope(Scope $scope)
$object = app($object);
}
- # Call Model Scope immediately when detected.
- #
- # @note: We don't use call_user_func_array() here
- # because of missing columns in returned query.
+ // Call Model Scope immediately when detected.
+ //
+ // @note: We don't use call_user_func_array() here
+ // because of missing columns in returned query.
$this->query = with(
$this->model->is($object) ? $this->query : $object
)->{$method}($this->query);
@@ -157,14 +159,14 @@ public function scope(Scope $scope)
* @param $element
* @param $direction
*
- * @return $this
- *
* @throws \Exception
+ *
+ * @return $this
*/
public function sort($element, $direction)
{
- # simple sorting
- if (in_array($element, $sortable = app('scaffold.module')->sortable())) {
+ // simple sorting
+ if (in_array($element, $sortable = app('scaffold.module')->sortable(), true)) {
if ($table = app('scaffold.module')->model()->getTable()) {
$element = "{$table}.{$element}";
}
@@ -179,7 +181,7 @@ public function sort($element, $direction)
if (array_key_exists($element, $sortable) && is_string($handler = $sortable[$element])) {
$handler = new $handler($this->query, $element, $direction);
if (!$handler instanceof QueryBuilder || !method_exists($handler, 'build')) {
- throw new \Exception('Handler class must implement ' . QueryBuilder::class . ' contract');
+ throw new \Exception('Handler class must implement '.QueryBuilder::class.' contract');
}
$this->query = $handler->build();
}
@@ -200,9 +202,9 @@ public function getQuery()
/**
* @param FormElement $element
*
- * @return \Illuminate\Database\Eloquent\Builder|static
- *
* @throws Exception
+ *
+ * @return \Illuminate\Database\Eloquent\Builder|static
*/
protected function assemblyQuery(FormElement $element)
{
@@ -212,7 +214,7 @@ protected function assemblyQuery(FormElement $element)
$name = $element->id();
$value = $input->getValue();
- if (is_null($value)) {
+ if (null === $value) {
return $this->query;
}
@@ -247,28 +249,29 @@ protected function applyQueryElementByType(Builder $query, $table, $column, $typ
case 'text':
case 'datalist':
$query->where("{$table}.{$column}", 'LIKE', "%{$value}%");
- break;
+ break;
case 'select':
case 'multiselect':
if (!is_array($value)) {
$value = [$value];
}
$query->whereIn("{$table}.{$column}", $value);
- break;
+ break;
case 'boolean':
case 'number':
$query->where("{$table}.{$column}", '=', (int) $value);
- break;
+ break;
case 'date':
$query->whereDate("{$table}.{$column}", '=', $value);
- break;
+ break;
case 'daterange':
list($date_from, $date_to) = explode(' - ', $value);
$query->whereBetween(\DB::raw("DATE({$table}.{$column})"), [$date_from, $date_to]);
+
break;
}
diff --git a/src/Filters/Element/Search.php b/src/Filters/Element/Search.php
index 17db0df..64c5725 100755
--- a/src/Filters/Element/Search.php
+++ b/src/Filters/Element/Search.php
@@ -14,6 +14,6 @@ class Search extends FormSearch implements Queryable
'data-type' => 'livesearch',
'data-url' => null,
'class' => 'form-control',
- 'placeholder' => 'Search...'
+ 'placeholder' => 'Search...',
];
}
diff --git a/src/Filters/Element/Text.php b/src/Filters/Element/Text.php
index 0f34d2f..0f2bd35 100755
--- a/src/Filters/Element/Text.php
+++ b/src/Filters/Element/Text.php
@@ -11,6 +11,6 @@ class Text extends FormText implements Queryable
use ExecutesQuery;
protected $attributes = [
- 'class' => 'form-control'
+ 'class' => 'form-control',
];
}
diff --git a/src/Filters/FilterElement.php b/src/Filters/FilterElement.php
index 4b7dac5..348339e 100755
--- a/src/Filters/FilterElement.php
+++ b/src/Filters/FilterElement.php
@@ -8,9 +8,8 @@
use Terranet\Administrator\Form\FormElement;
/**
- * Class FilterElement
+ * Class FilterElement.
*
- * @package Terranet\Administrator\Filters
*
* @method static FilterElement text(string $name)
* @method static FilterElement search(string $name)
@@ -26,12 +25,14 @@ class FilterElement extends FormElement
* Init FormElement object by calling static method.
*
* @example: FilterElement::text('title')
+ *
* @param $inputType
* @param $arguments
* @note:
* 1st argument = name,
* 2nd argument = html options,
* 3rd argument = values (select, radio, multicheckbox)
+ *
* @return
*/
public static function __callStatic($inputType, $arguments)
@@ -40,7 +41,7 @@ public static function __callStatic($inputType, $arguments)
$inputType = FilterInputFactory::make($name, $inputType);
- $element = (new static($name))->setInput(
+ $element = (new static($name))->setInput(
$inputType
);
@@ -51,7 +52,7 @@ public static function __callStatic($inputType, $arguments)
}
if (is_array($options = array_get($arguments, 2)) && !empty($options)
- && method_exists($input, "setOptions")
+ && method_exists($input, 'setOptions')
) {
$input->setOptions($options);
}
@@ -64,6 +65,7 @@ public static function __callStatic($inputType, $arguments)
*
* @param $id
* @param mixed string|Queryable $input
+ *
* @return mixed
*/
public static function custom($id, $input)
@@ -75,6 +77,7 @@ public static function custom($id, $input)
* Init default input type.
*
* @param $id
+ *
* @return Text
*/
protected function defaultInputType($id)
@@ -86,10 +89,11 @@ protected function defaultInputType($id)
* Make a Filter element.
*
* @param $input
+ *
* @return mixed
*/
protected function makeInput($input)
{
return FilterInputFactory::make($this->id(), $input);
}
-}
\ No newline at end of file
+}
diff --git a/src/Filters/InputFactory.php b/src/Filters/InputFactory.php
index ea9b586..52c4016 100755
--- a/src/Filters/InputFactory.php
+++ b/src/Filters/InputFactory.php
@@ -11,17 +11,19 @@ class InputFactory
*
* @param $name
* @param string $type
- * @return mixed
+ *
* @throws Exception
+ *
+ * @return mixed
*/
public static function make($name, $type = 'text')
{
- $input = "Terranet\\Administrator\\Filters\\Element\\" . ucfirst($type);
+ $input = 'Terranet\\Administrator\\Filters\\Element\\'.ucfirst($type);
if (!class_exists($input)) {
- throw new Exception(sprintf("Unknown type: %s", $type));
+ throw new Exception(sprintf('Unknown type: %s', $type));
}
return new $input($name);
}
-}
\ No newline at end of file
+}
diff --git a/src/Filters/Scope.php b/src/Filters/Scope.php
index 7aa7557..ba45480 100755
--- a/src/Filters/Scope.php
+++ b/src/Filters/Scope.php
@@ -12,6 +12,7 @@ class Scope extends ElementContainer
/**
* @param mixed $query
+ *
* @return $this
*/
public function setQuery($query = null)
@@ -62,4 +63,4 @@ public function icon()
{
return $this->icon;
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/Collection/Mutable.php b/src/Form/Collection/Mutable.php
index 926b4dc..6e21310 100755
--- a/src/Form/Collection/Mutable.php
+++ b/src/Form/Collection/Mutable.php
@@ -21,21 +21,23 @@ class Mutable extends BaseMutableCollection
* @param $element
* @param mixed string|Closure $inputType
* @param mixed null|int|string $position
- * @return $this
+ *
* @throws Exception
+ *
+ * @return $this
*/
public function create($element, $inputType = null, $position = null)
{
if (!(is_string($element) || $element instanceof FormElement)) {
- throw new Exception("\$element must be string or FormElement instance.");
+ throw new Exception('$element must be string or FormElement instance.');
}
- # Create new element from string declaration ("title").
+ // Create new element from string declaration ("title").
if (is_string($element)) {
$element = (new FormElement($element));
}
- # Create Form Input Element from string declaration ("textarea")
+ // Create Form Input Element from string declaration ("textarea")
if (is_string($inputType)) {
$oldInput = $element->getInput();
$newInput = InputFactory::make($element->id(), $inputType);
@@ -51,7 +53,7 @@ public function create($element, $inputType = null, $position = null)
);
}
- # Allow a callable input type.
+ // Allow a callable input type.
if (is_callable($inputType)) {
call_user_func_array($inputType, [$element]);
}
@@ -60,7 +62,7 @@ public function create($element, $inputType = null, $position = null)
return $this->insert($element, $position);
}
- # Push element
+ // Push element
$this->push($element);
if (null !== $position) {
@@ -75,6 +77,7 @@ public function create($element, $inputType = null, $position = null)
*
* @param $section
* @param null $position
+ *
* @return $this
*/
public function section($section, $position = null)
@@ -90,7 +93,7 @@ public function hasEditors($editor)
{
$this->validateEditor($editor);
- return !!$this->filter(function (FormElement $element) use ($editor) {
+ return (bool) $this->filter(function (FormElement $element) use ($editor) {
$input = $element->getInput();
if ('ckeditor' === $editor) {
@@ -111,12 +114,13 @@ public function hasEditors($editor)
/**
* @param $editor
+ *
* @throws Exception
*/
protected function validateEditor($editor)
{
- if (!in_array($editor, ['ckeditor', 'tinymce', 'medium', 'markdown'])) {
- throw new Exception(sprintf("Unknown editor %s", $editor));
+ if (!in_array($editor, ['ckeditor', 'tinymce', 'medium', 'markdown'], true)) {
+ throw new Exception(sprintf('Unknown editor %s', $editor));
}
}
@@ -124,6 +128,7 @@ protected function validateEditor($editor)
* Create element object from string.
*
* @param $element
+ *
* @return mixed
*/
protected function createElement($element)
@@ -139,4 +144,4 @@ protected function createMediaElement($collection)
{
return FormElement::media($collection);
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/Element.php b/src/Form/Element.php
index 1f56b52..eb0750c 100755
--- a/src/Form/Element.php
+++ b/src/Form/Element.php
@@ -18,7 +18,7 @@ abstract class Element implements HtmlElement, Validable, Relationship
protected $translatable = false;
- protected $view = null;
+ protected $view;
protected $viewParams = [];
@@ -52,6 +52,7 @@ public function setView($name, array $params = [])
* Init element from set of attributes.
*
* @param array $attributes
+ *
* @return $this
*/
public function setAttributes(array $attributes = [])
@@ -95,19 +96,19 @@ final public function html()
if ($renderer = $this->getView()) {
$params = $this->getViewParams();
- # prevent recursion call
- # when inside of view there is a call like: $element->html()
+ // prevent recursion call
+ // when inside of view there is a call like: $element->html()
$this->setView(null);
$html = (string) view($renderer, ['element' => $this] + $params);
- # restore view
+ // restore view
$this->setView($renderer);
} else {
$html = $this->render();
}
- return $html . $this->errors();
+ return $html.$this->errors();
}
/**
@@ -117,11 +118,14 @@ final public function html()
*/
abstract public function render();
+ public function getRepository()
+ {
+ return app('scaffold.model') ?: app('scaffold.module')->model();
+ }
+
protected function setDefaultValue()
{
- /**
- * If relation detected => try to extract value from relation or magnet link
- */
+ // If relation detected => try to extract value from relation or magnet link
if ($this->hasRelation() && ($repository = $this->getRepository())) {
if (!$value = $this->extractValueFromEloquentRelation($repository)) {
if ($magnet = $this->isMagnetParameter()) {
@@ -132,7 +136,7 @@ protected function setDefaultValue()
return $this->setValue($value);
}
- /**
+ /*
* Try to extract value from Closure provided by form configuration
* Note: checking for function_exists is set to ensure that \Closure is provided
* and protect calling functions when provided value is something like 'rand' which is also is_callable
@@ -145,18 +149,14 @@ protected function setDefaultValue()
}
}
- /**
- * Set default value from Eloquent model.
- */
+ // Set default value from Eloquent model.
if (($element = $this->getRepository()) && $element->exists) {
if ($value = $element->getAttribute($this->name)) {
return $this->setValue($value);
}
}
- /**
- * If column configured as a magnet link, so try to extract value form Request
- */
+ // If column configured as a magnet link, so try to extract value form Request
if ($magnet = $this->isMagnetParameter()) {
return $this->setValue($magnet[$this->getName()]);
}
@@ -164,11 +164,6 @@ protected function setDefaultValue()
return null;
}
- public function getRepository()
- {
- return app('scaffold.model') ?: app('scaffold.module')->model();
- }
-
protected function isMagnetParameter()
{
return array_key_exists(
diff --git a/src/Form/FormElement.php b/src/Form/FormElement.php
index 6451f24..70f0cb5 100755
--- a/src/Form/FormElement.php
+++ b/src/Form/FormElement.php
@@ -13,7 +13,6 @@
* instance of a special type, each form element
* is just injected to this object-container.
*
- * @package Terranet\Administrator\Form
*
* @method static FormElement text(string $name)
* @method static FormElement view(string $name)
@@ -75,12 +74,14 @@ public function __construct($id)
* Init FormElement object by calling static method.
*
* @example: FormElement::text('title')
+ *
* @param $inputType
* @param $arguments
* @note:
* 1st argument = name,
* 2nd argument = html options,
* 3rd argument = values (select, radio, multicheckbox)
+ *
* @return
*/
public static function __callStatic($inputType, $arguments)
@@ -90,7 +91,7 @@ public static function __callStatic($inputType, $arguments)
$inputType
);
- # View element receives 2nd optional argument -> path to view script
+ // View element receives 2nd optional argument -> path to view script
if (is_a($inputType, View::class) && ($view = array_get($arguments, 1))) {
$inputType->setView($view);
}
@@ -104,7 +105,7 @@ public static function __callStatic($inputType, $arguments)
}
if (is_array($options = array_get($arguments, 2)) && !empty($options)
- && method_exists($input, "setOptions")
+ && method_exists($input, 'setOptions')
) {
$input->setOptions($options);
}
@@ -120,7 +121,7 @@ public function __call($method, $arguments)
return $this;
}
- throw new \Exception("Call to undefined method: " . class_basename($this) . "::$method");
+ throw new \Exception('Call to undefined method: '.class_basename($this)."::$method");
}
/**
@@ -128,6 +129,7 @@ public function __call($method, $arguments)
*
* @param $id
* @param mixed string|BasicFormElement $input
+ *
* @return mixed
*/
public static function custom($id, $input)
@@ -147,13 +149,15 @@ public function getInput()
* Set wrapped input object.
*
* @param mixed string|FormElement $input
- * @return $this
+ *
* @throws Exception
+ *
+ * @return $this
*/
public function setInput($input)
{
if (!(is_string($input) || $input instanceof BasicFormElement)) {
- throw new Exception("Input must be a String or instance of FormElement Contract");
+ throw new Exception('Input must be a String or instance of FormElement Contract');
}
if (is_string($input)) {
@@ -165,7 +169,6 @@ public function setInput($input)
return $this;
}
-
/**
* @return mixed
*/
@@ -176,6 +179,7 @@ public function getDescription()
/**
* @param mixed $description
+ *
* @return $this
*/
public function setDescription($description)
@@ -187,6 +191,7 @@ public function setDescription($description)
/**
* @param $id
+ *
* @return Text
*/
protected function defaultInputType($id)
@@ -198,6 +203,7 @@ protected function defaultInputType($id)
* Make a Filter element.
*
* @param $input
+ *
* @return mixed
*/
protected function makeInput($input)
diff --git a/src/Form/FormSection.php b/src/Form/FormSection.php
index 45039b3..75e60a7 100755
--- a/src/Form/FormSection.php
+++ b/src/Form/FormSection.php
@@ -12,4 +12,4 @@ public function __construct($id, $title = null)
$this->setTitle($title);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/InputFactory.php b/src/Form/InputFactory.php
index b9a2d47..6d5a2ad 100755
--- a/src/Form/InputFactory.php
+++ b/src/Form/InputFactory.php
@@ -11,17 +11,19 @@ class InputFactory
*
* @param $name
* @param string $type
- * @return mixed
+ *
* @throws Exception
+ *
+ * @return mixed
*/
public static function make($name, $type = 'text')
{
- $input = "Terranet\\Administrator\\Form\\Type\\" . ucfirst($type);
+ $input = 'Terranet\\Administrator\\Form\\Type\\'.ucfirst($type);
if (!class_exists($input)) {
- throw new Exception(sprintf("Unknown type: %s", $type));
+ throw new Exception(sprintf('Unknown type: %s', $type));
}
return new $input($name);
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/Type/Boolean.php b/src/Form/Type/Boolean.php
index 870dca4..d875abd 100755
--- a/src/Form/Type/Boolean.php
+++ b/src/Form/Type/Boolean.php
@@ -12,7 +12,7 @@ class Boolean extends Element
public function render()
{
return
- Form::hidden($this->getFormName(), 0, $this->hiddenAttributes()) .
+ Form::hidden($this->getFormName(), 0, $this->hiddenAttributes()).
Form::checkbox($this->getFormName(), 1, $this->value, $this->attributes);
}
@@ -21,6 +21,6 @@ public function render()
*/
protected function hiddenAttributes()
{
- return ['id' => Form::getIdAttribute($this->getFormName(), $this->attributes) . '_hidden'];
+ return ['id' => Form::getIdAttribute($this->getFormName(), $this->attributes).'_hidden'];
}
}
diff --git a/src/Form/Type/Datalist.php b/src/Form/Type/Datalist.php
index d8261e9..e3872c7 100755
--- a/src/Form/Type/Datalist.php
+++ b/src/Form/Type/Datalist.php
@@ -8,30 +8,29 @@
class Datalist extends Select
{
protected $rules = [
- //
];
public function render()
{
$name = $this->getName();
- $id = 'scaffold_' . str_slug($name);
+ $id = 'scaffold_'.str_slug($name);
$attributes = array_merge($this->attributes, [
'list' => $id,
]);
$out[] = Form::text($this->getFormName(), $this->getValue(), $attributes);
- $out[] = '