Skip to content

Commit

Permalink
Composer unit test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
webchuckweb committed Jan 6, 2023
1 parent d0d9a5b commit 8605fad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/PhpAllyIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace CidiLabs\PhpAlly;

use DOMElement;
use DOMDocument;

class PhpAllyIssue implements \JsonSerializable {
class PhpAllyIssue implements \JsonSerializable
{
protected $ruleId;
protected $element;
protected $previewElement;
Expand Down Expand Up @@ -68,7 +68,7 @@ public function getPreview()
return $this->element->ownerDocument->saveHTML($this->previewElement);
}

public function toArray()
public function toArray(): array
{
return [
'ruleId' => $this->ruleId,
Expand All @@ -83,7 +83,7 @@ public function __toString()
return \json_encode($this->toArray());
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return $this->toArray();
}
Expand Down
17 changes: 9 additions & 8 deletions src/PhpAllyReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace CidiLabs\PhpAlly;

class PhpAllyReport implements \JsonSerializable {
class PhpAllyReport implements \JsonSerializable
{
protected $issues = [];
protected $errors = [];
protected $html = '';
Expand All @@ -12,7 +13,7 @@ public function __construct()
{
}

public function toArray()
public function toArray(): array
{
return [
'issues' => $this->getIssues(),
Expand All @@ -21,14 +22,14 @@ public function toArray()
];
}

public function jsonSerialize()
public function jsonSerialize(): array
{
return $this->toArray();
}

public function __toString()
{
return \json_encode($this->toArray());
return \json_encode($this->toArray());
}

public function getIssues()
Expand Down Expand Up @@ -66,9 +67,9 @@ public function getIssueCounts()
return $this->issueCounts;
}

public function setIssueCounts($ruleId, $issueCount, $total) {
$ruleId = str_replace(['CidiLabs\\PhpAlly\\Rule\\','App\\Rule\\'], '', $ruleId);
public function setIssueCounts($ruleId, $issueCount, $total)
{
$ruleId = str_replace(['CidiLabs\\PhpAlly\\Rule\\', 'App\\Rule\\'], '', $ruleId);
$this->issueCounts[$ruleId] = array('issueCount' => $issueCount, "totalCount" => $total);
}

}
}
4 changes: 1 addition & 3 deletions src/Rule/ContentTooLong.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace CidiLabs\PhpAlly\Rule;

use CidiLabs\PhpAlly\Rule\HtmlElement;

use DOMElement;

/**
Expand All @@ -22,6 +20,7 @@ public function check()
{
$pageText = '';
$wordCount = 0;
$this->totalTests++;

// Ignore html with script tags
if (count($this->getAllElements('script')) === 0) {
Expand All @@ -31,7 +30,6 @@ public function check()
if($text != null){
$pageText = $pageText . $text;
}
$this->totalTests++;
}
$wordCount = str_word_count($pageText);

Expand Down

0 comments on commit 8605fad

Please sign in to comment.