Skip to content

Commit

Permalink
Fix phpdoc (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Jan 24, 2024
1 parent 16784ea commit c6aa5b2
Show file tree
Hide file tree
Showing 46 changed files with 99 additions and 101 deletions.
27 changes: 11 additions & 16 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
MIT License

Copyright (c) 2023 yii-tools
Copyright (c) 2024 by Wilmer Arámbula (https://github.com/terabytesoftw) All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6 changes: 3 additions & 3 deletions src/Attribute/Aria/HasAriaControls.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ trait HasAriaControls
protected bool|string $ariaControls = false;

/**
* Set the aria-controls attribute, which identifies the element(s) whose contents or presence are controlled
* by the current element.
* Set the aria-controls attribute, which identifies the element(s) whose contents or presence is controlled by the
* current element.
*
* The aria-controls attribute is used in WAI-ARIA to define a relationship between a controller element and
* controlled elements, typically used for accessibility in web applications.
Expand All @@ -30,7 +30,7 @@ public function ariaControls(bool|string $value): static
$new = clone $this;

if ($value === true) {
$new->ariaControls = $value;
$new->ariaControls = true;
} else {
$new->ariaControls = false;
$new->attributes['aria-controls'] = $value;
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Aria/HasAriaDescribedBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait HasAriaDescribedBy
protected bool|string $ariaDescribedBy = false;

/**
* Set the aria-describedby attribute, which identifies the element(s) that describe the current element.
* Set the aria-describedby attribute, which identifies the element(s) that describes the current element.
*
* The aria-describedby attribute is used in WAI-ARIA to provide a relationship between an element and its
* descriptive elements. This helps screen readers and other assistive technologies provide additional context
Expand All @@ -29,7 +29,7 @@ public function ariaDescribedBy(string|bool $value = true): static
$new = clone $this;

if ($value === true) {
$new->ariaDescribedBy = $value;
$new->ariaDescribedBy = true;
} else {
$new->attributes['aria-describedby'] = $value;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Aria/HasRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use function is_string;

/**
* Is used by widgets which require an role attribute.
* Is used by widgets which require a role attribute.
*/
trait HasRole
{
Expand All @@ -30,7 +30,7 @@ public function role(bool|string $value): static
$new = clone $this;

if ($value === true) {
$new->role = $value;
$new->role = true;
} elseif (is_string($value)) {
$new->attributes['role'] = $value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Component/HasActivateItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait HasActivateItems
*
* @param bool $value Whether to activate menu items when their route is the currently requested one.
*
* @return static A new instance of the current class with the specified activate items value.
* @return static A new instance of the current class with the specified activated items value.
*/
public function activateItems(bool $value): static
{
Expand Down
10 changes: 5 additions & 5 deletions src/Attribute/Component/HasBrand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ trait HasBrand
/**
* Enable or disable the brand container tag `<div>`.
*
* @param bool $value If enabled or disabled the item container tag `<div>`.
* @param bool $value If enabled or disabled, the item container tag `<div>`.
* Default is `false`.
*
* @return static A new instance of the current class with the specified brand container.
Expand Down Expand Up @@ -96,7 +96,7 @@ public function brandContainerTag(string $value): static
public function brandImage(string|ElementInterface $value): static
{
$new = clone $this;
$new->brandImage = Encode::santizeXSS($value);
$new->brandImage = Encode::sanitizeXSS($value);

return $new;
}
Expand All @@ -117,7 +117,7 @@ public function brandLink(string $value): static
}

/**
* Set the the `HTML` attributes for the brand link.
* Set the `HTML` attributes for the brand link.
*
* @return static A new instance of the current class with the specified brand link attributes.
*/
Expand Down Expand Up @@ -171,7 +171,7 @@ public function brandTemplate(string $value): static
public function brandText(string|ElementInterface $value): static
{
$new = clone $this;
$new->brandText = Encode::santizeXSS($value);
$new->brandText = Encode::sanitizeXSS($value);

return $new;
}
Expand All @@ -186,7 +186,7 @@ public function brandText(string|ElementInterface $value): static
public function brandToggle(string|ElementInterface $value): static
{
$new = clone $this;
$new->brandToggle = Encode::santizeXSS($value);
$new->brandToggle = Encode::sanitizeXSS($value);

return $new;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Component/HasIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function iconFilePath(string $value): static
/**
* Set the icon tag name.
*
* @param false|string $value The tag name for the icon element. if `false` the icon content will be used.
* @param false|string $value The tag name for the icon element. If `false` the icon content will be used.
*
* @throws InvalidArgumentException If the icon tag is an empty string.
*
Expand Down
5 changes: 3 additions & 2 deletions src/Attribute/Component/HasList.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ public function listContainerClass(string $value, bool $override = false): stati
/**
* Set list type for tag `<ul>` or `<ol>`.
*
* @param false|string $value The list type. `ul` for unordered list, `ol` for ordered list, `false` to disable.
* @param false|string $value The list type. `ul` for an unordered list, `ol` for an ordered list, `false` to
* disable.
*
* @return static A new instance of the current class with the specified list type for tag `<ul>` or `<ol>`.
*/
public function listType(string|false $value): static
{
if (in_array($value, ['ul', 'ol'], true) === false && $value !== false) {
if ($value !== false && in_array($value, ['ul', 'ol'], true) === false) {
throw new InvalidArgumentException(sprintf('Invalid list type "%s".', $value));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Component/HasListItemContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait HasListItemContainer
*
* @return static A new instance of the current class with the specified container for list items.
*/
public function listItemcontainer(bool $value): static
public function listItemContainer(bool $value): static
{
$new = clone $this;
$new->listItemContainer = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Component/HasMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait HasMenu
public function menu(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->menu = Encode::santizeXSS(...$values);
$new->menu = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Component/HasSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function summaryLabel(string $value): static
/**
* Set the separator text for summary current page.
*
* @param string $value The separator text for summary current page. Default value is ` of `.
* @param string $value The separator text for summary current page. The default value is ` of `.
*
* @return static A new instance of the current class with the specified separator text for summary current page.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Component/HasToggle.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function toggleClass(string $value): static
public function toggleContent(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->toggleContent = Encode::santizeXSS(...$values);
$new->toggleContent = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down Expand Up @@ -175,7 +175,7 @@ public function toggleSuffix(string $value): static
*
* @param string $value The tag name for the toggle element.
*
* @throws InvalidArgumentException If the toogle tag is an empty string.
* @throws InvalidArgumentException If the toggle tag is an empty string.
*
* @return static A new instance of the current class with the specified toggle tag.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Component/HasToggleButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait HasToggleButton
protected string $toggleButton = '';

/**
* Set the button toogle for the toggle.
* Set the button toggle for the toggle.
*
* @param ElementInterface|string ...$values The button content.
*
Expand All @@ -24,7 +24,7 @@ trait HasToggleButton
public function toggleButton(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->toggleButton = Encode::santizeXSS(...$values);
$new->toggleButton = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Custom/HasAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use function array_merge;

/**
* Is used by widgets which implement the attributes method.
* Is used by widgets which implement the attribute method.
*
* @link https://www.w3.org/TR/html52/dom.html#global-attributes
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Custom/HasContainerPrefixAndSuffix.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait HasContainerPrefixAndSuffix
public function containerPrefix(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->containerPrefix = Encode::santizeXSS(...$values);
$new->containerPrefix = Encode::sanitizeXSS(...$values);

return $new;
}
Expand All @@ -40,7 +40,7 @@ public function containerPrefix(string|ElementInterface ...$values): static
public function containerSuffix(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->containerSuffix = Encode::santizeXSS(...$values);
$new->containerSuffix = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Custom/HasContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait HasContent
public function content(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->content = Encode::santizeXSS(...$values);
$new->content = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Custom/HasCsrf.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait HasCsrf
protected string $csrfToken = '';

/**
* Set the CSRF-token attribute token that is known to be safe to use.
* Set the CSRF-token attribute token known to be safe to use.
*
* @param string|Stringable $csrfToken The CSRF-token attribute value.
* @param string $csrfName The CSRF-token attribute name.
Expand Down
8 changes: 4 additions & 4 deletions src/Attribute/Custom/HasLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public function labelClass(string $value, bool $override = false): static
/**
* Set the `HTML` label content.
*
* @param ElementInterface|string $values The `HTML` label content value.
* @param ElementInterface|string ...$values The `HTML` label content value.
*
* @return static A new instance of the current class with the specified `HTML` label content.
*/
public function labelContent(string|ElementInterface ...$values): static
public function labelContent(ElementInterface|string ...$values): static
{
$new = clone $this;
$new->labelContent = Encode::santizeXSS(...$values);
$new->labelContent = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down Expand Up @@ -97,7 +97,7 @@ public function notLabel(): static
/**
* Render the label tag.
*
* @param string $labelFor The `for` attribute value.
* @param string|null $labelFor The `for` attribute value.
*
* @return string The rendered label tag.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Custom/HasPrefixAndSuffix.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ trait HasPrefixAndSuffix
public function prefix(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->prefix = Encode::santizeXSS(...$values);
$new->prefix = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down Expand Up @@ -116,7 +116,7 @@ public function prefixContainerTag(string $value): static
public function suffix(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->suffix = Encode::santizeXSS(...$values);
$new->suffix = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Custom/HasPrefixAndSuffixItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait HasPrefixAndSuffixItems
public function prefixItems(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->prefixItems = Encode::santizeXSS(...$values);
$new->prefixItems = Encode::sanitizeXSS(...$values);

return $new;
}
Expand All @@ -40,7 +40,7 @@ public function prefixItems(string|ElementInterface ...$values): static
public function suffixItems(string|ElementInterface ...$values): static
{
$new = clone $this;
$new->suffixItems = Encode::santizeXSS(...$values);
$new->suffixItems = Encode::sanitizeXSS(...$values);

return $new;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Custom/HasWidgetValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
trait HasWidgetValidation
{
/**
* Validate if the value is a iterable or null based on the type.
* Validate if the value is an iterable or null based on the type.
*
* @param mixed $value The value to validate.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Input/CanBeChecked.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait CanBeChecked
*
* If present on a radio type, it indicates that the radio button is the currently selected one in the group of
* same-named radio buttons. If present on a checkbox type, it indicates that the checkbox is checked by default
* (when the page loads). It does not indicate whether this checkbox is currently checked: if the checkbox's state
* (when the page loads). It does not indicate whether this checkbox is currently checked: if the checkbox state
* is changed, this content attribute does not reflect the change.
*
* @param bool $value The value of the checked attribute.
Expand Down
6 changes: 3 additions & 3 deletions src/Attribute/Input/HasAccept.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
trait HasAccept
{
/**
* Set the accept attribute value is a string that defines the file types the file input should accept.
* Set the accepted attribute value is a string that defines the file types the file input should accept.
* This string is a comma-separated list of unique file type specifiers.
*
* Because a given file type may be identified in more than one manner, it's useful to provide a thorough set of
* type specifiers when you need files of a given format.
*
* @param string $value The value of the accept attribute.
* @param string $value The value of the accepted attribute.
*
* @return static A new instance of the current class with the specified accept value.
* @return static A new instance of the current class with the specified accepted value.
*
* @link https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/Input/HasHeight.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ trait HasHeight
{
/**
* Set the height attribute valid for the image input button or img only, the height of the image file to display to
* represent the graphical submit button.
* represent the graphical submitted button.
*
* Must be an integer without a unit or a percentage value, i.e. a number followed immediately by "%".
* Must be an integer without a unit or a percentage value, i.e., a number followed immediately by "%".
*
* @param int|string $value The width of the widget.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Attribute/Input/HasSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trait HasSize
{
/**
* Set the size attribute valid for email, password, tel, url, and text, specifies how much of the input is shown.
* Basically creates same result as setting CSS width property with a few specialities.
* Basically creates the same result as setting CSS width property with a few specialities.
*
* The actual unit of the value depends on the input type. For password and text, it is a number of characters
* (or em units) with a default value of 20, and for others, it is pixels (or px units).
Expand Down

0 comments on commit c6aa5b2

Please sign in to comment.