Skip to content

Commit

Permalink
Execute PHP-CS-Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarStark committed Aug 12, 2024
1 parent f6fd03d commit 11f571f
Show file tree
Hide file tree
Showing 85 changed files with 766 additions and 1,225 deletions.
40 changes: 8 additions & 32 deletions src/Api/Glances/Glance.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of the Pushover package.
*
* (c) Serhiy Lunak <https://github.com/slunak>
Expand Down Expand Up @@ -32,17 +32,17 @@
class Glance
{
/**
* @var Application Pushover application.
* @var Application pushover application
*/
private $application;

/**
* @var Recipient Pushover user.
* @var Recipient pushover user
*/
private $recipient;

/**
* @var GlanceDataFields Glance Data Fields.
* @var GlanceDataFields glance Data Fields
*/
private $glanceDataFields;

Expand All @@ -52,73 +52,49 @@ public function __construct(Application $application, GlanceDataFields $glanceDa
$this->glanceDataFields = $glanceDataFields;
}

/**
* @return Application
*/
public function getApplication(): Application
{
return $this->application;
}

/**
* @param Application $application
*/
public function setApplication(Application $application): void
{
$this->application = $application;
}

/**
* @return Recipient
*/
public function getRecipient(): Recipient
{
return $this->recipient;
}

/**
* @param Recipient $recipient
*/
public function setRecipient(Recipient $recipient): void
{
$this->recipient = $recipient;
}

/**
* @return GlanceDataFields
*/
public function getGlanceDataFields(): GlanceDataFields
{
return $this->glanceDataFields;
}

/**
* @param GlanceDataFields $glanceDataFields
*/
public function setGlanceDataFields(GlanceDataFields $glanceDataFields): void
{
$this->glanceDataFields = $glanceDataFields;
}

/**
* @return bool
*/
public function hasAtLeastOneField(): bool
{
if (null === $this->getGlanceDataFields()->getTitle() &&
null === $this->getGlanceDataFields()->getSubtext() &&
null === $this->getGlanceDataFields()->getCount() &&
null === $this->getGlanceDataFields()->getPercent()
if (null === $this->getGlanceDataFields()->getTitle()
&& null === $this->getGlanceDataFields()->getSubtext()
&& null === $this->getGlanceDataFields()->getCount()
&& null === $this->getGlanceDataFields()->getPercent()
) {
return false;
}

return true;
}

/**
* @return bool
*/
public function hasRecipient(): bool
{
if (null === $this->recipient) {
Expand Down
73 changes: 19 additions & 54 deletions src/Api/Glances/GlanceDataFields.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of the Pushover package.
*
* (c) Serhiy Lunak <https://github.com/slunak>
Expand All @@ -25,138 +25,103 @@
class GlanceDataFields
{
/**
* @var string|null (100 characters) - a description of the data being shown, such as "Widgets Sold".
* @var null|string (100 characters) - a description of the data being shown, such as "Widgets Sold"
*/
private $title;

/**
* @var string|null (100 characters) - the main line of data, used on most screens.
* @var null|string (100 characters) - the main line of data, used on most screens
*/
private $text;

/**
* @var string|null (100 characters) - a second line of data.
* @var null|string (100 characters) - a second line of data
*/
private $subtext;

/**
* @var int|null (integer, may be negative) - shown on smaller screens; useful for simple counts.
* @var null|int (integer, may be negative) - shown on smaller screens; useful for simple counts
*/
private $count;

/**
* @var int|null (integer 0 through 100, inclusive) - shown on some screens as a progress bar/circle.
* @var null|int (integer 0 through 100, inclusive) - shown on some screens as a progress bar/circle
*/
private $percent;

public function __construct()
{
}

/**
* @return string|null
*/
public function getTitle(): ?string
{
return $this->title;
}

/**
* @param string|null $title
* @return GlanceDataFields
*/
public function setTitle(?string $title): GlanceDataFields
public function setTitle(?string $title): self
{
if ($title !== null && strlen($title) > 100) {
throw new InvalidArgumentException(sprintf("Title can be no more than 100 characters long. %s characters long title provided.", strlen($title)));
if ($title !== null && \strlen($title) > 100) {
throw new InvalidArgumentException(sprintf('Title can be no more than 100 characters long. %s characters long title provided.', \strlen($title)));
}

$this->title = $title;

return $this;
}

/**
* @return string|null
*/
public function getText(): ?string
{
return $this->text;
}

/**
* @param string|null $text
* @return GlanceDataFields
*/
public function setText(?string $text): GlanceDataFields
public function setText(?string $text): self
{
if ($text !== null && strlen($text) > 100) {
throw new InvalidArgumentException(sprintf("Text can be no more than 100 characters long. %s characters long text provided.", strlen($text)));
if ($text !== null && \strlen($text) > 100) {
throw new InvalidArgumentException(sprintf('Text can be no more than 100 characters long. %s characters long text provided.', \strlen($text)));
}

$this->text = $text;

return $this;
}

/**
* @return string|null
*/
public function getSubtext(): ?string
{
return $this->subtext;
}

/**
* @param string|null $subtext
* @return GlanceDataFields
*/
public function setSubtext(?string $subtext): GlanceDataFields
public function setSubtext(?string $subtext): self
{
if ($subtext !== null && strlen($subtext) > 100) {
throw new InvalidArgumentException(sprintf("Subtext can be no more than 100 characters long. %s characters long subtext provided.", strlen($subtext)));
if ($subtext !== null && \strlen($subtext) > 100) {
throw new InvalidArgumentException(sprintf('Subtext can be no more than 100 characters long. %s characters long subtext provided.', \strlen($subtext)));
}

$this->subtext = $subtext;

return $this;
}

/**
* @return int|null
*/
public function getCount(): ?int
{
return $this->count;
}

/**
* @param int|null $count
* @return GlanceDataFields
*/
public function setCount(?int $count): GlanceDataFields
public function setCount(?int $count): self
{
$this->count = $count;

return $this;
}

/**
* @return int|null
*/
public function getPercent(): ?int
{
return $this->percent;
}

/**
* @param int|null $percent
* @return GlanceDataFields
*/
public function setPercent(?int $percent): GlanceDataFields
public function setPercent(?int $percent): self
{
if (! ($percent >= 0 && $percent <= 100)) {
throw new InvalidArgumentException(sprintf("Percent should be an integer 0 through 100, inclusive. %s provided.", $percent));
if (!($percent >= 0 && $percent <= 100)) {
throw new InvalidArgumentException(sprintf('Percent should be an integer 0 through 100, inclusive. %s provided.', $percent));
}

$this->percent = $percent;
Expand Down
Loading

0 comments on commit 11f571f

Please sign in to comment.