@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | trait Traits_Classable |
27 | 27 | { |
28 | - /** |
|
29 | - * @var string[] |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var string[] |
|
30 | + */ |
|
31 | 31 | protected $classes = array(); |
32 | 32 | |
33 | 33 | public function addClass(string $name) |
@@ -65,30 +65,30 @@ discard block |
||
65 | 65 | return $this; |
66 | 66 | } |
67 | 67 | |
68 | - /** |
|
69 | - * Retrieves a list of all classes, if any. |
|
70 | - * |
|
71 | - * @return string[] |
|
72 | - */ |
|
68 | + /** |
|
69 | + * Retrieves a list of all classes, if any. |
|
70 | + * |
|
71 | + * @return string[] |
|
72 | + */ |
|
73 | 73 | public function getClasses() : array |
74 | 74 | { |
75 | 75 | return $this->classes; |
76 | 76 | } |
77 | 77 | |
78 | - /** |
|
79 | - * Renders the class names list as space-separated string for use in an HTML tag. |
|
80 | - * |
|
81 | - * @return string |
|
82 | - */ |
|
78 | + /** |
|
79 | + * Renders the class names list as space-separated string for use in an HTML tag. |
|
80 | + * |
|
81 | + * @return string |
|
82 | + */ |
|
83 | 83 | public function classesToString() : string |
84 | 84 | { |
85 | 85 | return implode(' ', $this->classes); |
86 | 86 | } |
87 | 87 | |
88 | - /** |
|
89 | - * Renders the "class" attribute string for inserting into an HTML tag. |
|
90 | - * @return string |
|
91 | - */ |
|
88 | + /** |
|
89 | + * Renders the "class" attribute string for inserting into an HTML tag. |
|
90 | + * @return string |
|
91 | + */ |
|
92 | 92 | public function classesToAttribute() : string |
93 | 93 | { |
94 | 94 | if(!empty($this->classes)) |
@@ -117,42 +117,42 @@ discard block |
||
117 | 117 | */ |
118 | 118 | interface Interface_Classable |
119 | 119 | { |
120 | - /** |
|
121 | - * @param string $name |
|
122 | - * @return $this |
|
123 | - */ |
|
120 | + /** |
|
121 | + * @param string $name |
|
122 | + * @return $this |
|
123 | + */ |
|
124 | 124 | public function addClass(string $name); |
125 | 125 | |
126 | - /** |
|
127 | - * @param array $names |
|
128 | - * @return $this |
|
129 | - */ |
|
126 | + /** |
|
127 | + * @param array $names |
|
128 | + * @return $this |
|
129 | + */ |
|
130 | 130 | public function addClasses(array $names); |
131 | 131 | |
132 | - /** |
|
133 | - * @param string $name |
|
134 | - * @return bool |
|
135 | - */ |
|
132 | + /** |
|
133 | + * @param string $name |
|
134 | + * @return bool |
|
135 | + */ |
|
136 | 136 | public function hasClass(string $name) : bool; |
137 | 137 | |
138 | - /** |
|
139 | - * @param string $name |
|
140 | - * @return $this |
|
141 | - */ |
|
138 | + /** |
|
139 | + * @param string $name |
|
140 | + * @return $this |
|
141 | + */ |
|
142 | 142 | public function removeClass(string $name); |
143 | 143 | |
144 | - /** |
|
145 | - * @return array |
|
146 | - */ |
|
144 | + /** |
|
145 | + * @return array |
|
146 | + */ |
|
147 | 147 | public function getClasses() : array; |
148 | 148 | |
149 | - /** |
|
150 | - * @return string |
|
151 | - */ |
|
149 | + /** |
|
150 | + * @return string |
|
151 | + */ |
|
152 | 152 | public function classesToString() : string; |
153 | 153 | |
154 | - /** |
|
155 | - * @return string |
|
156 | - */ |
|
154 | + /** |
|
155 | + * @return string |
|
156 | + */ |
|
157 | 157 | public function classesToAttribute() : string; |
158 | 158 | } |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | { |
25 | 25 | use Traits_Optionable; |
26 | 26 | |
27 | - /** |
|
28 | - * @see https://gist.github.com/gruber/249502 |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @see https://gist.github.com/gruber/249502 |
|
29 | + */ |
|
30 | 30 | const REGEX_URL = '#(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))#i'; |
31 | 31 | |
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | 35 | protected $subject; |
36 | 36 | |
37 | - /** |
|
38 | - * @var string[] |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var string[] |
|
39 | + */ |
|
40 | 40 | protected $schemes = array( |
41 | 41 | 'http', |
42 | 42 | 'https', |
@@ -62,49 +62,49 @@ discard block |
||
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | - /** |
|
66 | - * Whether to enable sorting the URLs alphabetically (disabled by default). |
|
67 | - * |
|
68 | - * @param bool $enabled |
|
69 | - * @return ConvertHelper_URLFinder |
|
70 | - */ |
|
65 | + /** |
|
66 | + * Whether to enable sorting the URLs alphabetically (disabled by default). |
|
67 | + * |
|
68 | + * @param bool $enabled |
|
69 | + * @return ConvertHelper_URLFinder |
|
70 | + */ |
|
71 | 71 | public function enableSorting(bool $enabled=true) : ConvertHelper_URLFinder |
72 | 72 | { |
73 | 73 | $this->setOption('sorting', $enabled); |
74 | 74 | return $this; |
75 | 75 | } |
76 | 76 | |
77 | - /** |
|
78 | - * Whether to include email addresses in the search. |
|
79 | - * This is only relevant when using the getURLs() |
|
80 | - * method. |
|
81 | - * |
|
82 | - * @param bool $include |
|
83 | - * @return ConvertHelper_URLFinder |
|
84 | - */ |
|
77 | + /** |
|
78 | + * Whether to include email addresses in the search. |
|
79 | + * This is only relevant when using the getURLs() |
|
80 | + * method. |
|
81 | + * |
|
82 | + * @param bool $include |
|
83 | + * @return ConvertHelper_URLFinder |
|
84 | + */ |
|
85 | 85 | public function includeEmails(bool $include=true) : ConvertHelper_URLFinder |
86 | 86 | { |
87 | 87 | $this->setOption('include-emails', $include); |
88 | 88 | return $this; |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * Whether to omit the mailto: that is automatically added to all email addresses. |
|
93 | - * |
|
94 | - * @param bool $omit |
|
95 | - * @return ConvertHelper_URLFinder |
|
96 | - */ |
|
91 | + /** |
|
92 | + * Whether to omit the mailto: that is automatically added to all email addresses. |
|
93 | + * |
|
94 | + * @param bool $omit |
|
95 | + * @return ConvertHelper_URLFinder |
|
96 | + */ |
|
97 | 97 | public function omitMailto(bool $omit=true) : ConvertHelper_URLFinder |
98 | 98 | { |
99 | 99 | $this->setOption('omit-mailto', $omit); |
100 | 100 | return $this; |
101 | 101 | } |
102 | 102 | |
103 | - /** |
|
104 | - * Prepares the subject string by adding a newline before all URL schemes, |
|
105 | - * to make it possible to parse even lists of links separated by commas or |
|
106 | - * the like (http://domain.com,http://domain2.com). |
|
107 | - */ |
|
103 | + /** |
|
104 | + * Prepares the subject string by adding a newline before all URL schemes, |
|
105 | + * to make it possible to parse even lists of links separated by commas or |
|
106 | + * the like (http://domain.com,http://domain2.com). |
|
107 | + */ |
|
108 | 108 | private function prepareSubject() : void |
109 | 109 | { |
110 | 110 | $replaces = array(); |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | $this->subject = str_replace(array_keys($replaces), array_values($replaces), $this->subject); |
118 | 118 | } |
119 | 119 | |
120 | - /** |
|
121 | - * Fetches all URLs that can be found in the subject string. |
|
122 | - * |
|
123 | - * @return string[] |
|
124 | - */ |
|
120 | + /** |
|
121 | + * Fetches all URLs that can be found in the subject string. |
|
122 | + * |
|
123 | + * @return string[] |
|
124 | + */ |
|
125 | 125 | public function getURLs() : array |
126 | 126 | { |
127 | 127 | $this->prepareSubject(); |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | return $result; |
155 | 155 | } |
156 | 156 | |
157 | - /** |
|
158 | - * Retrieves all email addresses from the subject string. |
|
159 | - * |
|
160 | - * @return string[] |
|
161 | - * |
|
162 | - * @see omitMailto() |
|
163 | - */ |
|
157 | + /** |
|
158 | + * Retrieves all email addresses from the subject string. |
|
159 | + * |
|
160 | + * @return string[] |
|
161 | + * |
|
162 | + * @see omitMailto() |
|
163 | + */ |
|
164 | 164 | public function getEmails() : array |
165 | 165 | { |
166 | 166 | $matches = array(); |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | return 'mailto:'; |
195 | 195 | } |
196 | 196 | |
197 | - /** |
|
198 | - * Retrieves all URLs as URLInfo instances. |
|
199 | - * |
|
200 | - * @return URLInfo[] |
|
201 | - */ |
|
197 | + /** |
|
198 | + * Retrieves all URLs as URLInfo instances. |
|
199 | + * |
|
200 | + * @return URLInfo[] |
|
201 | + */ |
|
202 | 202 | public function getInfos() |
203 | 203 | { |
204 | 204 | $urls = $this->getURLs(); |