Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
add instance
Browse files Browse the repository at this point in the history
  • Loading branch information
holyshared committed Sep 2, 2014
1 parent b4c1c73 commit 61feb73
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/entity/SourceFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ public function getCoverages()
return $this->coverages;
}

/**
* @return CoverageCollection
*/
public function getEmptyCoverages()
{
return $this->coverages->newInstance();
}

/**
* @param CoverageInterface $coverage
* @throws \coverallskit\exception\LineOutOfRangeException
Expand Down
16 changes: 16 additions & 0 deletions src/entity/collection/CoverageCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ public function at($lineAt)
return $coverage->get();
}

/**
* @return int
*/
public function getLastLineNumber()
{
return $this->lineRange->getLastLineNumber();
}

/**
* @return CoverageCollection
*/
public function newInstance()
{
return new self($this->getLastLineNumber());
}

/**
* @return bool
*/
Expand Down

0 comments on commit 61feb73

Please sign in to comment.