Formatting

Signed-off-by: Adam Engebretson <adam.engebretson@bridgeconx.com>
This commit is contained in:
Adam Engebretson committed 2015-12-01 01:46:08 -06:00
1 parent c772164bff
commit 24d14f259d
6 files changed
+31 -24

No files matched your search

+18 -19
View File
@@ -10,6 +10,7 @@ use Illuminate\Support\Traits\Macroable;
class FormBuilder class FormBuilder
{ {
use Macroable; use Macroable;
/** /**
@@ -81,8 +82,6 @@ class FormBuilder
* @param \Illuminate\Contracts\Routing\UrlGenerator $url * @param \Illuminate\Contracts\Routing\UrlGenerator $url
* @param \Collective\Html\HtmlBuilder $html * @param \Collective\Html\HtmlBuilder $html
* @param string $csrfToken * @param string $csrfToken
*
* @return void
*/ */
public function __construct(HtmlBuilder $html, UrlGenerator $url, $csrfToken) public function __construct(HtmlBuilder $html, UrlGenerator $url, $csrfToken)
{ {
@@ -134,7 +133,7 @@ class FormBuilder
// extra value for the hidden _method field if it's needed for the form. // extra value for the hidden _method field if it's needed for the form.
$attributes = $this->html->attributes($attributes); $attributes = $this->html->attributes($attributes);
return '<form'.$attributes.'>'.$append; return '<form' . $attributes . '>' . $append;
} }
/** /**
@@ -185,7 +184,7 @@ class FormBuilder
*/ */
public function token() public function token()
{ {
$token = !empty($this->csrfToken) ? $this->csrfToken : $this->session->getToken(); $token = ! empty($this->csrfToken) ? $this->csrfToken : $this->session->getToken();
return $this->hidden('_token', $token); return $this->hidden('_token', $token);
} }
@@ -207,7 +206,7 @@ class FormBuilder
$value = e($this->formatLabel($name, $value)); $value = e($this->formatLabel($name, $value));
return '<label for="'.$name.'"'.$options.'>'.$value.'</label>'; return '<label for="' . $name . '"' . $options . '>' . $value . '</label>';
} }
/** /**
@@ -235,7 +234,7 @@ class FormBuilder
*/ */
public function input($type, $name, $value = null, $options = []) public function input($type, $name, $value = null, $options = [])
{ {
if (!isset($options['name'])) { if ( ! isset($options['name'])) {
$options['name'] = $name; $options['name'] = $name;
} }
@@ -244,7 +243,7 @@ class FormBuilder
// in the model instance if one is set. Otherwise we will just use empty. // in the model instance if one is set. Otherwise we will just use empty.
$id = $this->getIdAttribute($name, $options); $id = $this->getIdAttribute($name, $options);
if (!in_array($type, $this->skipValueTypes)) { if ( ! in_array($type, $this->skipValueTypes)) {
$value = $this->getValueAttribute($name, $value); $value = $this->getValueAttribute($name, $value);
} }
@@ -255,7 +254,7 @@ class FormBuilder
$options = array_merge($options, $merge); $options = array_merge($options, $merge);
return '<input'.$this->html->attributes($options).'>'; return '<input' . $this->html->attributes($options) . '>';
} }
/** /**
@@ -447,7 +446,7 @@ class FormBuilder
*/ */
public function textarea($name, $value = null, $options = []) public function textarea($name, $value = null, $options = [])
{ {
if (!isset($options['name'])) { if ( ! isset($options['name'])) {
$options['name'] = $name; $options['name'] = $name;
} }
@@ -467,7 +466,7 @@ class FormBuilder
// the element. Then we'll create the final textarea elements HTML for us. // the element. Then we'll create the final textarea elements HTML for us.
$options = $this->html->attributes($options); $options = $this->html->attributes($options);
return '<textarea'.$options.'>'.e($value).'</textarea>'; return '<textarea' . $options . '>' . e($value) . '</textarea>';
} }
/** /**
@@ -526,7 +525,7 @@ class FormBuilder
$options['id'] = $this->getIdAttribute($name, $options); $options['id'] = $this->getIdAttribute($name, $options);
if (!isset($options['name'])) { if ( ! isset($options['name'])) {
$options['name'] = $name; $options['name'] = $name;
} }
@@ -644,7 +643,7 @@ class FormBuilder
$html[] = $this->option($display, $value, $selected); $html[] = $this->option($display, $value, $selected);
} }
return '<optgroup label="'.e($label).'">'.implode('', $html).'</optgroup>'; return '<optgroup label="' . e($label) . '">' . implode('', $html) . '</optgroup>';
} }
/** /**
@@ -662,7 +661,7 @@ class FormBuilder
$options = ['value' => $value, 'selected' => $selected]; $options = ['value' => $value, 'selected' => $selected];
return '<option'.$this->html->attributes($options).'>'.e($display).'</option>'; return '<option' . $this->html->attributes($options) . '>' . e($display) . '</option>';
} }
/** /**
@@ -680,7 +679,7 @@ class FormBuilder
$options = compact('selected'); $options = compact('selected');
$options['value'] = ''; $options['value'] = '';
return '<option'.$this->html->attributes($options).'>'.e($display).'</option>'; return '<option' . $this->html->attributes($options) . '>' . e($display) . '</option>';
} }
/** /**
@@ -791,7 +790,7 @@ class FormBuilder
*/ */
protected function getCheckboxCheckedState($name, $value, $checked) protected function getCheckboxCheckedState($name, $value, $checked)
{ {
if (isset($this->session) && !$this->oldInputIsEmpty() && is_null($this->old($name))) { if (isset($this->session) && ! $this->oldInputIsEmpty() && is_null($this->old($name))) {
return false; return false;
} }
@@ -906,11 +905,11 @@ class FormBuilder
*/ */
public function button($value = null, $options = []) public function button($value = null, $options = [])
{ {
if (!array_key_exists('type', $options)) { if ( ! array_key_exists('type', $options)) {
$options['type'] = 'button'; $options['type'] = 'button';
} }
return '<button'.$this->html->attributes($options).'>'.$value.'</button>'; return '<button' . $this->html->attributes($options) . '>' . $value . '</button>';
} }
/** /**
@@ -1066,11 +1065,11 @@ class FormBuilder
return $value; return $value;
} }
if (!is_null($this->old($name))) { if ( ! is_null($this->old($name))) {
return $this->old($name); return $this->old($name);
} }
if (!is_null($value)) { if ( ! is_null($value)) {
return $value; return $value;
} }
+1
View File
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Facade;
*/ */
class FormFacade extends Facade class FormFacade extends Facade
{ {
/** /**
* Get the registered name of the component. * Get the registered name of the component.
* *
+6 -1
View File
@@ -495,6 +495,7 @@ class HtmlBuilder
* @param $name * @param $name
* @param $view * @param $view
* @param array $signature * @param array $signature
*
* @return void * @return void
*/ */
public static function component($name, $view, array $signature) public static function component($name, $view, array $signature)
@@ -506,6 +507,7 @@ class HtmlBuilder
* Check if a component is registered. * Check if a component is registered.
* *
* @param $name * @param $name
*
* @return bool * @return bool
*/ */
public static function hasComponent($name) public static function hasComponent($name)
@@ -518,6 +520,7 @@ class HtmlBuilder
* *
* @param $name * @param $name
* @param array $arguments * @param array $arguments
*
* @return \Illuminate\Contracts\View\View * @return \Illuminate\Contracts\View\View
*/ */
protected function renderComponent($name, array $arguments) protected function renderComponent($name, array $arguments)
@@ -533,6 +536,7 @@ class HtmlBuilder
* *
* @param array $signature * @param array $signature
* @param array $arguments * @param array $arguments
*
* @return array * @return array
*/ */
protected function getComponentData(array $signature, array $arguments) protected function getComponentData(array $signature, array $arguments)
@@ -540,7 +544,7 @@ class HtmlBuilder
$data = []; $data = [];
$i = 0; $i = 0;
foreach($signature as $variable => $default) { foreach ($signature as $variable => $default) {
// If the "variable" value is actually a numeric key, we can assume that // If the "variable" value is actually a numeric key, we can assume that
// no default had been specified for the component argument and we'll // no default had been specified for the component argument and we'll
// just use null instead, so that we can treat them all the same. // just use null instead, so that we can treat them all the same.
@@ -562,6 +566,7 @@ class HtmlBuilder
* *
* @param string $method * @param string $method
* @param array $parameters * @param array $parameters
*
* @return \Illuminate\Contracts\View\View|mixed * @return \Illuminate\Contracts\View\View|mixed
* *
* @throws \BadMethodCallException * @throws \BadMethodCallException
+1
View File
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Facade;
*/ */
class HtmlFacade extends Facade class HtmlFacade extends Facade
{ {
/** /**
* Get the registered name of the component. * Get the registered name of the component.
* *
+1
View File
@@ -6,6 +6,7 @@ use Illuminate\Support\ServiceProvider;
class HtmlServiceProvider extends ServiceProvider class HtmlServiceProvider extends ServiceProvider
{ {
/** /**
* Indicates if loading of the provider is deferred. * Indicates if loading of the provider is deferred.
* *
+4 -4
View File
@@ -1,6 +1,6 @@
<?php <?php
if (!function_exists('link_to')) { if ( ! function_exists('link_to')) {
/** /**
* Generate a HTML link. * Generate a HTML link.
* *
@@ -17,7 +17,7 @@ if (!function_exists('link_to')) {
} }
} }
if (!function_exists('link_to_asset')) { if ( ! function_exists('link_to_asset')) {
/** /**
* Generate a HTML link to an asset. * Generate a HTML link to an asset.
* *
@@ -34,7 +34,7 @@ if (!function_exists('link_to_asset')) {
} }
} }
if (!function_exists('link_to_route')) { if ( ! function_exists('link_to_route')) {
/** /**
* Generate a HTML link to a named route. * Generate a HTML link to a named route.
* *
@@ -51,7 +51,7 @@ if (!function_exists('link_to_route')) {
} }
} }
if (!function_exists('link_to_action')) { if ( ! function_exists('link_to_action')) {
/** /**
* Generate a HTML link to a controller action. * Generate a HTML link to a controller action.
* *