Skip to content

Commit

Permalink
Add some more doc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
exussum12 committed Jan 12, 2017
1 parent 34e21ce commit e1330b1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/FileMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface FileMatcher
* @param string[] $haystack list of potential file matches
*
* @return string the matched file
* @throws FileNotFound
*/
public function match($needle, array $haystack);
}
13 changes: 13 additions & 0 deletions src/FileMatchers/EndsWith.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
use exussum12\CoverageChecker\FileMatcher;
use exussum12\CoverageChecker\Exceptions\FileNotFound;

/**
* Class EndsWith
* @package exussum12\CoverageChecker\FileMatchers
*/
class EndsWith implements FileMatcher
{

/**
* {@inheritdoc}
*/
public function match($needle, array $haystack)
{
foreach ($haystack as $file) {
Expand All @@ -18,6 +25,12 @@ public function match($needle, array $haystack)
throw new FileNotFound();
}

/**
* Month for finding if two strings end in the same way
* @param $haystack
* @param $needle
* @return bool
*/
protected function endsWith($haystack, $needle)
{
$length = strlen($needle);
Expand Down
5 changes: 1 addition & 4 deletions src/FileMatchers/Prefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ public function __construct($prefix)
}

/**
* @param string $needle
* @param array $haystack
* @return mixed
* @throws FileNotFound
* {@inheritdoc}
*/
public function match($needle, array $haystack)
{
Expand Down
5 changes: 2 additions & 3 deletions tests/FileMatchers/PrefixTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace exussum12\CoverageChecker\tests\FileMatchers;

use PHPUnit\Framework\TestCase;
use exussum12\CoverageChecker\Exceptions\FileNotFound;
use exussum12\CoverageChecker\FileMatchers\Prefix;

class PrefixTest extends TestCase
Expand All @@ -22,11 +23,9 @@ public function testPrefix()
);
}

/**
* @expectedException exussum12\CoverageChecker\Exceptions\FileNotFound
*/
public function testDoesNotExist()
{
$this->expectException(FileNotFound::class);
$prefixMatcher = new Prefix('/full/path/to/');
$needle = "fileDoesNotExist.php";
$haystack = [];
Expand Down

0 comments on commit e1330b1

Please sign in to comment.