Skip to content

Commit 4147f3a

Browse files
committed
php-cs-fixer fix
1 parent 6de5e28 commit 4147f3a

32 files changed

+193
-106
lines changed

src/Forms/ColorField.php

+9-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color
1212
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color#Value wrt value
1313
*/
14-
class ColorField extends TextField {
14+
class ColorField extends TextField
15+
{
1516

1617
use Core;
1718
use Datalist;
@@ -24,7 +25,8 @@ class ColorField extends TextField {
2425
* Returns the value saved as a 6 chr RGB colour with # prefixed
2526
* @return string
2627
*/
27-
public function dataValue() {
28+
public function dataValue()
29+
{
2830
$value = $this->getValidRGB($this->value);
2931
return $value;
3032
}
@@ -42,7 +44,8 @@ public function Value()
4244
* @param string $value an RGB colour value as a 'valid simple colour'
4345
* @return void
4446
*/
45-
public function setValue($value, $data = null) {
47+
public function setValue($value, $data = null)
48+
{
4649
$this->value = $this->getValidRGB($value);
4750
}
4851

@@ -61,7 +64,8 @@ public function setValue($value, $data = null) {
6164
* representing the red component, the middle two digits representing the green component,
6265
* and the last two digits representing the blue component, in hexadecimal.</blockquote>
6366
*/
64-
public function getValidRGB($value, Validator $validator = null) {
67+
public function getValidRGB($value, Validator $validator = null)
68+
{
6569

6670
// empty values default to the empty value value
6771
if(!$value) {
@@ -71,7 +75,7 @@ public function getValidRGB($value, Validator $validator = null) {
7175
$value = strtolower($value);
7276

7377
// If input is not exactly seven characters long, then return an error.
74-
if(mb_strlen( $value ) != 7) {
78+
if(mb_strlen($value) != 7) {
7579
if($validator) {
7680
$validator->validationError(
7781
$this->name,

src/Forms/ColourField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
/**
66
* Provides a class for those of us not using en_US
77
*/
8-
class ColourField extends ColorField {
8+
class ColourField extends ColorField
9+
{
910

1011
protected $template = "Codem/Utilities/HTML5/ColorField";
1112

src/Forms/DateField.php

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* Provides a date field
99
* @author James
1010
*/
11-
class DateField extends TextField {
11+
class DateField extends TextField
12+
{
1213

1314
use Core;
1415
use Datalist;
@@ -21,15 +22,18 @@ class DateField extends TextField {
2122

2223
protected $example = "2020-12-31";
2324

24-
protected function formatDate(\Datetime $datetime) {
25-
return $datetime->format( $this->datetime_format );
25+
protected function formatDate(\Datetime $datetime)
26+
{
27+
return $datetime->format($this->datetime_format);
2628
}
2729

28-
public function setMin(\DateTime $min) {
30+
public function setMin(\DateTime $min)
31+
{
2932
return $this->setAttribute('min', $this->formatDate($min));
3033
}
3134

32-
public function setMax(\DateTime $max) {
35+
public function setMax(\DateTime $max)
36+
{
3337
return $this->setAttribute('max', $this->formatDate($max));
3438
}
3539

src/Forms/DatetimeField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
* but with hour and minute selection
88
* @author James
99
*/
10-
class DatetimeField extends DateField {
10+
class DatetimeField extends DateField
11+
{
1112

1213
protected $inputType = 'datetime-local';
1314

src/Forms/EmailField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* Text input field with validation for correct email format according to RFC 2822.
99
* @author james
1010
*/
11-
class EmailField extends CoreEmailField {
11+
class EmailField extends CoreEmailField
12+
{
1213

1314
use Core;
1415
use Datalist;

src/Forms/MonthField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
* but with month and year selection
88
* @author James
99
*/
10-
class MonthField extends DateField {
10+
class MonthField extends DateField
11+
{
1112

1213
protected $inputType = 'month';
1314

src/Forms/NumberField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* Number input field
99
* @author James
1010
*/
11-
class NumberField extends TextField {
11+
class NumberField extends TextField
12+
{
1213

1314
use Core;
1415
use Datalist;

src/Forms/RangeField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
/**
88
* Range input field
99
*/
10-
class RangeField extends TextField {
10+
class RangeField extends TextField
11+
{
1112

1213
use Core;
1314
use Datalist;

src/Forms/SearchField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* Search input field
99
* @author James
1010
*/
11-
class SearchField extends TextField {
11+
class SearchField extends TextField
12+
{
1213

1314
use Core;
1415
use Datalist;

src/Forms/TelField.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* From <input> elements of type tel are used to let the user enter and edit a telephone number.
99
* @author James
1010
*/
11-
class TelField extends TextField {
11+
class TelField extends TextField
12+
{
1213

1314
use Core;
1415
use Datalist;
@@ -20,7 +21,8 @@ class TelField extends TextField {
2021
/**
2122
* @inheritdoc
2223
*/
23-
public function Type() {
24+
public function Type()
25+
{
2426
return 'tel text';
2527
}
2628

src/Forms/TimeField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
* Provides a time field, limited to hour and minute selection only
77
* @author James
88
*/
9-
class TimeField extends DateField {
9+
class TimeField extends DateField
10+
{
1011

1112
protected $inputType = 'time';
1213

src/Forms/UrlField.php

+19-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
/**
99
* Provides a URL input field
1010
*/
11-
class UrlField extends TextField {
11+
class UrlField extends TextField
12+
{
1213

1314
use Core;
1415
use Datalist;
@@ -28,7 +29,8 @@ class UrlField extends TextField {
2829
/**
2930
* @inheritdoc
3031
*/
31-
public function Type() {
32+
public function Type()
33+
{
3234
return 'url text';
3335
}
3436

@@ -86,7 +88,8 @@ public function validate($validator)
8688
return true;
8789
}
8890

89-
public function setRequiredParts(array $requiredParts) {
91+
public function setRequiredParts(array $requiredParts)
92+
{
9093
$this->requiredParts = $requiredParts;
9194
return $this;
9295
}
@@ -95,7 +98,8 @@ public function setRequiredParts(array $requiredParts) {
9598
* Parse a possible URL string
9699
* If the second parameter is provided, the URL must have those parts
97100
*/
98-
public function parseURL(string $url) : bool {
101+
public function parseURL(string $url) : bool
102+
{
99103
if($url == '') {
100104
// an empty URL is a valid URL
101105
return true;
@@ -104,7 +108,7 @@ public function parseURL(string $url) : bool {
104108
$parts = parse_url($url);
105109
if(empty($this->requiredParts)) {
106110
return !empty($parts);
107-
} else {
111+
} else {
108112
// ensure all of the required parts are present in all of the keys
109113
$result = array_intersect($this->requiredParts, array_keys($parts));
110114
sort($result);
@@ -116,19 +120,22 @@ public function parseURL(string $url) : bool {
116120
/**
117121
* Schemes are set by calling restrictToSchemes
118122
*/
119-
protected function setSchemes(array $schemes) {
123+
protected function setSchemes(array $schemes)
124+
{
120125
$this->schemes = $schemes;
121126
return $this;
122127
}
123128

124-
public function getSchemes() {
129+
public function getSchemes()
130+
{
125131
return $this->schemes;
126132
}
127133

128134
/**
129135
* Restrict to http (and https) protocols
130136
*/
131-
public function restrictToHttp() {
137+
public function restrictToHttp()
138+
{
132139
$this->restrictToSchemes(["https","http"]);
133140
$this->setAttribute(
134141
'placeholder',
@@ -143,14 +150,16 @@ public function restrictToHttp() {
143150
/**
144151
* Restrict to URLs beginning with https://
145152
*/
146-
public function restrictToHttps() {
153+
public function restrictToHttps()
154+
{
147155
return $this->restrictToSchemes(["https"]);
148156
}
149157

150158
/**
151159
* Restrict to URLs beginning with the provided scheme
152160
*/
153-
public function restrictToSchemes(array $schemes) {
161+
public function restrictToSchemes(array $schemes)
162+
{
154163
$this->setSchemes($schemes);
155164
$schemesString = implode("://, ", $schemes) . "://";
156165
$this->setAttribute(

src/Forms/WeekField.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
* year plus the ISO 8601 week number during that year (i.e., week 1 to 52 or 53).
99
* @author James
1010
*/
11-
class WeekField extends DateField {
11+
class WeekField extends DateField
12+
{
1213

1314
protected $inputType = 'week';
1415

src/Traits/Core.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@
66
* Core common attribute methods
77
* @author James
88
*/
9-
trait Core {
9+
trait Core
10+
{
1011

11-
protected function bool2str($value) {
12+
protected function bool2str($value)
13+
{
1214
return $value ? 'true' : 'false';
1315
}
1416

15-
public function setSpellcheck($spellcheck) {
17+
public function setSpellcheck($spellcheck)
18+
{
1619
return $this->setAttribute('spellcheck', $this->bool2str($spellcheck));
1720
}
1821

19-
public function getSpellcheck() {
22+
public function getSpellcheck()
23+
{
2024
return $this->getAttribute('spellcheck');
2125
}
2226

src/Traits/Datalist.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
* Datalist trait used for supporting inputs that can have a <datalist>
1010
* @author James
1111
*/
12-
trait Datalist {
12+
trait Datalist
13+
{
1314

1415
/**
1516
* @var array
@@ -24,13 +25,14 @@ trait Datalist {
2425
/**
2526
* Return values for a <datalist>
2627
*/
27-
protected function createDataList(array $datalist) : ArrayList {
28+
protected function createDataList(array $datalist) : ArrayList
29+
{
2830
$list = ArrayList::create();
2931
foreach($datalist as $value => $label) {
30-
$list->push( ArrayData::create([
32+
$list->push(ArrayData::create([
3133
'Value' => $value,
3234
'Label' => $label
33-
]) );
35+
]));
3436
}
3537
return $list;
3638
}
@@ -41,7 +43,8 @@ protected function createDataList(array $datalist) : ArrayList {
4143
* @param string $id optional datalist id attribute
4244
* @return FormField
4345
*/
44-
public function setDatalist(array $datalist, $id = null) {
46+
public function setDatalist(array $datalist, $id = null)
47+
{
4548
$this->inputDatalist = $this->createDataList($datalist);
4649
if(!$id) {
4750
$id = $this->ID() . "_datalist";
@@ -51,21 +54,24 @@ public function setDatalist(array $datalist, $id = null) {
5154
return $this;
5255
}
5356

54-
public function getDatalist() : ?ArrayList {
57+
public function getDatalist() : ?ArrayList
58+
{
5559
return $this->inputDatalist;
5660
}
5761

5862
/**
5963
* Return datalist id value
6064
*/
61-
public function Datalist() : ?ArrayList {
65+
public function Datalist() : ?ArrayList
66+
{
6267
return $this->getDatalist();
6368
}
6469

6570
/**
6671
* Return datalist id value
6772
*/
68-
public function DatalistID() : ?string {
73+
public function DatalistID() : ?string
74+
{
6975
return $this->inputDatalistId;
7076
}
7177

0 commit comments

Comments
 (0)