Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjoydesk authored and StyleCIBot committed Jun 7, 2017
1 parent 42fabec commit faf39fd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Cygnite/Common/UrlManager/Url.php
Expand Up @@ -40,7 +40,7 @@ public function __construct(Manager $urlManager)
*/
public static function __callStatic($method, $arguments = [])
{
if (method_exists(static::$urlManager, $method)){
if (method_exists(static::$urlManager, $method)) {
return call_user_func_array([static::$urlManager, $method], $arguments);
}

Expand All @@ -53,7 +53,7 @@ public static function __callStatic($method, $arguments = [])
*/
public function __call($method, $arguments)
{
if (method_exists(static::$urlManager, $method)){
if (method_exists(static::$urlManager, $method)) {
return call_user_func_array([static::$urlManager, $method], $arguments);
}

Expand Down
9 changes: 2 additions & 7 deletions src/Cygnite/FormBuilder/Html/Elements.php
Expand Up @@ -157,12 +157,10 @@ private function composeElement($key, $attributes, $extra = [], $hasCloseTag = f

$val = '';
if ($hasCloseTag) {

if (is_object($this->entity)) {

if (method_exists($this->entity, 'get'.Inflector::camelize($key))) {
$val = $this->entity->{'get'.Inflector::camelize($key)}();
} else if (property_exists($this->entity, $key)) {
} elseif (property_exists($this->entity, $key)) {
$property = (new \ReflectionClass($this->entity))->getProperty($key);
if ($property->isPublic()) {
$val = $property->getValue();
Expand Down Expand Up @@ -288,9 +286,7 @@ protected function attributes($attributes)
$elementStr = '';

foreach ($attributes as $key => $value) {

$elementStr .= ($key !== 0) ? "{$key}='{$value}' " : $value;

$elementStr .= ($key !== 0) ? "{$key}='{$value}' " : $value;
}

return $elementStr;
Expand Down Expand Up @@ -336,7 +332,6 @@ protected function highlightErrorElement($key, $attributes)
$this->validator instanceof ValidatorInterface &&
$this->validator->hasError($key)
) {

preg_match_all("#class='([^\s]+)'#", $this->attributes($attributes), $matches);
$elClass = "class='".implode(' ', array_merge([$this->errorInputClass], $matches[1]))."'";
unset($attributes['class']);
Expand Down
2 changes: 1 addition & 1 deletion src/Cygnite/Mvc/View/View.php
Expand Up @@ -27,7 +27,7 @@
*
* @author Sanjoy Dey <dey.sanjoy0@gmail.com>
*/
class View extends Composer implements ViewInterface,\ArrayAccess
class View extends Composer implements ViewInterface, \ArrayAccess
{
use ControllerViewBridgeTrait;

Expand Down
2 changes: 1 addition & 1 deletion src/Cygnite/Router/Router.php
Expand Up @@ -777,7 +777,7 @@ private function getConfigParameter()
}

/**
*
*
the request.
*
* @param $request
Expand Down
6 changes: 3 additions & 3 deletions src/Cygnite/Validation/Validator.php
Expand Up @@ -167,7 +167,7 @@ public function run()
// Executes rule for min and max validation.
if (string_has($rule, ':') && strstr($rule, 'max') || strstr($rule, 'min')) {
$isValid = $this->doValidateMinMax($rule, $key, $isValid);
} else if (string_has($rule, ':') && (!strstr($rule, 'max') && !strstr($rule, 'min'))) {
} elseif (string_has($rule, ':') && (!strstr($rule, 'max') && !strstr($rule, 'min'))) {
// Executes rule for other than min, max validation with ":" keyword in rule.
$isValid = $this->validateRulesHasPlaceHolder($key, $rule, $isValid);
} else {
Expand Down Expand Up @@ -287,7 +287,7 @@ protected function required(string $key) : bool
ucfirst($this->convertToFieldName($key)).' is required';

return false;
} else if (is_array($val) && count($val) < 1) {
} elseif (is_array($val) && count($val) < 1) {
$this->errors[$key.self::ERROR] =
ucfirst($this->convertToFieldName($key)).' is required';

Expand Down Expand Up @@ -777,7 +777,7 @@ protected function isDate($key) : bool
if ((!is_string($value) && !is_numeric($value)) || strtotime($value) === false) {
$this->errors[$key.self::ERROR] = $this->convertToFieldName($key).' must be a valid date.';
return false;
} else if (checkdate($date['month'], $date['day'], $date['year'])) {
} elseif (checkdate($date['month'], $date['day'], $date['year'])) {
return true;
}

Expand Down

0 comments on commit faf39fd

Please sign in to comment.