@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @version 1.001 |
| 6 | 6 | * Generates a JSON field validator |
| 7 | 7 | */ |
| 8 | -class FieldValidation implements \JsonSerializable{ |
|
| 8 | +class FieldValidation implements \JsonSerializable { |
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | protected $optional; |
| 24 | 24 | |
| 25 | - public function __construct($identifier){ |
|
| 25 | + public function __construct($identifier) { |
|
| 26 | 26 | $this->identifier=$identifier; |
| 27 | 27 | $this->rules=[]; |
| 28 | 28 | } |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | return $this->rules; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
| 44 | - if($type instanceof Rule) |
|
| 43 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
| 44 | + if ($type instanceof Rule) |
|
| 45 | 45 | $this->rules[]=$type; |
| 46 | 46 | else |
| 47 | - $this->rules[]=new Rule($type,$prompt,$value); |
|
| 47 | + $this->rules[]=new Rule($type, $prompt, $value); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function jsonSerialize(){ |
|
| 51 | - return ["identifier"=>$this->identifier,"rules"=>$this->rules]; |
|
| 50 | + public function jsonSerialize() { |
|
| 51 | + return ["identifier"=>$this->identifier, "rules"=>$this->rules]; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function setDepends($depends) { |
@@ -41,10 +41,11 @@ |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function addRule($type,$prompt=NULL,$value=NULL){ |
| 44 | - if($type instanceof Rule) |
|
| 45 | - $this->rules[]=$type; |
|
| 46 | - else |
|
| 47 | - $this->rules[]=new Rule($type,$prompt,$value); |
|
| 44 | + if($type instanceof Rule) { |
|
| 45 | + $this->rules[]=$type; |
|
| 46 | + } else { |
|
| 47 | + $this->rules[]=new Rule($type,$prompt,$value); |
|
| 48 | + } |
|
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | public function jsonSerialize(){ |
@@ -55,10 +55,12 @@ |
||
| 55 | 55 | |
| 56 | 56 | public function jsonSerialize() { |
| 57 | 57 | $result= ["type"=>$this->type]; |
| 58 | - if(isset($this->prompt)) |
|
| 59 | - $result["prompt"]=$this->prompt; |
|
| 60 | - if(isset($this->value)) |
|
| 61 | - $result["value"]=$this->value; |
|
| 58 | + if(isset($this->prompt)) { |
|
| 59 | + $result["prompt"]=$this->prompt; |
|
| 60 | + } |
|
| 61 | + if(isset($this->value)) { |
|
| 62 | + $result["value"]=$this->value; |
|
| 63 | + } |
|
| 62 | 64 | return $result; |
| 63 | 65 | } |
| 64 | 66 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @version 1.001 |
| 6 | 6 | * Generates a JSON Rule for the validation of a field |
| 7 | 7 | */ |
| 8 | -class Rule implements \JsonSerializable{ |
|
| 8 | +class Rule implements \JsonSerializable { |
|
| 9 | 9 | /** |
| 10 | 10 | * @var string |
| 11 | 11 | */ |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | private $value; |
| 22 | 22 | |
| 23 | - public function __construct($type,$prompt=NULL,$value=NULL){ |
|
| 23 | + public function __construct($type, $prompt=NULL, $value=NULL) { |
|
| 24 | 24 | $this->type=$type; |
| 25 | 25 | $this->prompt=$prompt; |
| 26 | 26 | $this->value=$value; |
@@ -54,76 +54,76 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function jsonSerialize() { |
| 57 | - $result= ["type"=>$this->type]; |
|
| 58 | - if(isset($this->prompt)) |
|
| 57 | + $result=["type"=>$this->type]; |
|
| 58 | + if (isset($this->prompt)) |
|
| 59 | 59 | $result["prompt"]=$this->prompt; |
| 60 | - if(isset($this->value)) |
|
| 60 | + if (isset($this->value)) |
|
| 61 | 61 | $result["value"]=$this->value; |
| 62 | 62 | return $result; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public static function match($name,$prompt=NULL){ |
|
| 66 | - return new Rule("match[".$name."]",$prompt); |
|
| 65 | + public static function match($name, $prompt=NULL) { |
|
| 66 | + return new Rule("match[".$name."]", $prompt); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public static function integer($min=0,$max=100,$prompt=NULL){ |
|
| 70 | - return new Rule("integer[{$min}..{$max}]",$prompt); |
|
| 69 | + public static function integer($min=0, $max=100, $prompt=NULL) { |
|
| 70 | + return new Rule("integer[{$min}..{$max}]", $prompt); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public static function decimal($prompt=NULL){ |
|
| 74 | - return new Rule("decimal",$prompt); |
|
| 73 | + public static function decimal($prompt=NULL) { |
|
| 74 | + return new Rule("decimal", $prompt); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public static function number($prompt=NULL){ |
|
| 78 | - return new Rule("number",$prompt); |
|
| 77 | + public static function number($prompt=NULL) { |
|
| 78 | + return new Rule("number", $prompt); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public static function is($value,$prompt=NULL){ |
|
| 82 | - return new Rule("is[".$value."]",$prompt); |
|
| 81 | + public static function is($value, $prompt=NULL) { |
|
| 82 | + return new Rule("is[".$value."]", $prompt); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public static function isExactly($value,$prompt=NULL){ |
|
| 86 | - return new Rule("isExactly[".$value."]",$prompt); |
|
| 85 | + public static function isExactly($value, $prompt=NULL) { |
|
| 86 | + return new Rule("isExactly[".$value."]", $prompt); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public static function not($value,$prompt=NULL){ |
|
| 90 | - return new Rule("not[".$value."]",$prompt); |
|
| 89 | + public static function not($value, $prompt=NULL) { |
|
| 90 | + return new Rule("not[".$value."]", $prompt); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public static function notExactly($value,$prompt=NULL){ |
|
| 94 | - return new Rule("notExactly[".$value."]",$prompt); |
|
| 93 | + public static function notExactly($value, $prompt=NULL) { |
|
| 94 | + return new Rule("notExactly[".$value."]", $prompt); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public static function contains($value,$prompt=NULL){ |
|
| 98 | - return new Rule("contains[".$value."]",$prompt); |
|
| 97 | + public static function contains($value, $prompt=NULL) { |
|
| 98 | + return new Rule("contains[".$value."]", $prompt); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public static function containsExactly($value,$prompt=NULL){ |
|
| 102 | - return new Rule("containsExactly[".$value."]",$prompt); |
|
| 101 | + public static function containsExactly($value, $prompt=NULL) { |
|
| 102 | + return new Rule("containsExactly[".$value."]", $prompt); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - public static function doesntContain($value,$prompt=NULL){ |
|
| 106 | - return new Rule("doesntContain[".$value."]",$prompt); |
|
| 105 | + public static function doesntContain($value, $prompt=NULL) { |
|
| 106 | + return new Rule("doesntContain[".$value."]", $prompt); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public static function doesntContainExactly($value,$prompt=NULL){ |
|
| 110 | - return new Rule("doesntContainExactly[".$value."]",$prompt); |
|
| 109 | + public static function doesntContainExactly($value, $prompt=NULL) { |
|
| 110 | + return new Rule("doesntContainExactly[".$value."]", $prompt); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public static function minCount($value,$prompt=NULL){ |
|
| 114 | - return new Rule("minCount[".$value."]",$prompt); |
|
| 113 | + public static function minCount($value, $prompt=NULL) { |
|
| 114 | + return new Rule("minCount[".$value."]", $prompt); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public static function maxCount($value,$prompt=NULL){ |
|
| 118 | - return new Rule("maxCount[".$value."]",$prompt); |
|
| 117 | + public static function maxCount($value, $prompt=NULL) { |
|
| 118 | + return new Rule("maxCount[".$value."]", $prompt); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public static function exactCount($value,$prompt=NULL){ |
|
| 122 | - return new Rule("exactCount[".$value."]",$prompt); |
|
| 121 | + public static function exactCount($value, $prompt=NULL) { |
|
| 122 | + return new Rule("exactCount[".$value."]", $prompt); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public static function email($prompt=NULL){ |
|
| 126 | - return new Rule("email",$prompt); |
|
| 125 | + public static function email($prompt=NULL) { |
|
| 126 | + return new Rule("email", $prompt); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | } |
| 130 | 130 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @param int $colCount |
| 19 | 19 | * @return HtmlTable |
| 20 | 20 | */ |
| 21 | - public function htmlTable($identifier, $rowCount, $colCount){ |
|
| 21 | + public function htmlTable($identifier, $rowCount, $colCount) { |
|
| 22 | 22 | return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount)); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | * @param $styles string|array|NULL |
| 30 | 30 | * @return HtmlMessage |
| 31 | 31 | */ |
| 32 | - public function htmlMessage($identifier, $content="",$styles=NULL) { |
|
| 33 | - $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
| 34 | - if(isset($msg)) |
|
| 32 | + public function htmlMessage($identifier, $content="", $styles=NULL) { |
|
| 33 | + $msg=$this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
| 34 | + if (isset($msg)) |
|
| 35 | 35 | $msg->setStyle($styles); |
| 36 | 36 | return $msg; |
| 37 | 37 | } |
@@ -31,8 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function htmlMessage($identifier, $content="",$styles=NULL) { |
| 33 | 33 | $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
| 34 | - if(isset($msg)) |
|
| 35 | - $msg->setStyle($styles); |
|
| 34 | + if(isset($msg)) { |
|
| 35 | + $msg->setStyle($styles); |
|
| 36 | + } |
|
| 36 | 37 | return $msg; |
| 37 | 38 | } |
| 38 | 39 | |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | * @param string|array $params |
| 128 | 128 | * @return Modal |
| 129 | 129 | */ |
| 130 | - public function modal($attachTo=NULL, $params=NULL,$paramsParts=NULL) { |
|
| 131 | - $result= $this->addComponent(new Modal($this->js), $attachTo, $params); |
|
| 130 | + public function modal($attachTo=NULL, $params=NULL, $paramsParts=NULL) { |
|
| 131 | + $result=$this->addComponent(new Modal($this->js), $attachTo, $params); |
|
| 132 | 132 | $result->setParamParts($paramsParts); |
| 133 | 133 | return $result; |
| 134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @return Tab |
| 140 | 140 | */ |
| 141 | 141 | public function tab($attachTo=NULL, $params=NULL) { |
| 142 | - $result= $this->addComponent(new Tab($this->js), $attachTo, $params); |
|
| 142 | + $result=$this->addComponent(new Tab($this->js), $attachTo, $params); |
|
| 143 | 143 | return $result; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @return Shape |
| 150 | 150 | */ |
| 151 | 151 | public function shape($attachTo=NULL, $params=NULL) { |
| 152 | - $result= $this->addComponent(new Shape($this->js), $attachTo, $params); |
|
| 152 | + $result=$this->addComponent(new Shape($this->js), $attachTo, $params); |
|
| 153 | 153 | return $result; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @return Form |
| 160 | 160 | */ |
| 161 | 161 | public function form($attachTo=NULL, $params=NULL) { |
| 162 | - $result= $this->addComponent(new Form($this->js), $attachTo, $params); |
|
| 162 | + $result=$this->addComponent(new Form($this->js), $attachTo, $params); |
|
| 163 | 163 | return $result; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | use function Composer\Autoload\includeFile; |
| 22 | 22 | |
| 23 | 23 | class Semantic extends BaseGui { |
| 24 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
| 25 | - SemanticHtmlModulesTrait,SemanticHtmlViewsTrait; |
|
| 24 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait, |
|
| 25 | + SemanticHtmlModulesTrait, SemanticHtmlViewsTrait; |
|
| 26 | 26 | |
| 27 | 27 | private $language; |
| 28 | 28 | |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | return $this->addHtmlComponent(new HtmlSticky($identifier, $content)); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function setLanguage($language){ |
|
| 114 | - if($language!==$this->language){ |
|
| 113 | + public function setLanguage($language) { |
|
| 114 | + if ($language!==$this->language) { |
|
| 115 | 115 | $file=\realpath(dirname(__FILE__)."/semantic/components/validation/languages/".$language.".js"); |
| 116 | - if(\file_exists($file)){ |
|
| 116 | + if (\file_exists($file)) { |
|
| 117 | 117 | $script=\file_get_contents($file); |
| 118 | - $this->js->exec($script,true); |
|
| 118 | + $this->js->exec($script, true); |
|
| 119 | 119 | $this->language=$language; |
| 120 | 120 | } |
| 121 | 121 | } |