Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added phpdoc to FileChange #1

Merged
merged 3 commits into from
Dec 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/Gitonomy/Git/Diff/FileChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ class FileChange
protected $rangeNewCount;
protected $lines;

/**
* @param int $rangeOldStart
* @param int $rangeOldCount
* @param int $rangeNewStart
* @param int $rangeNewCount
* @param array $lines
*
* @return void
*/
public function __construct($rangeOldStart, $rangeOldCount, $rangeNewStart, $rangeNewCount, $lines)
{
$this->rangeOldStart = $rangeOldStart;
Expand All @@ -33,6 +42,9 @@ public function __construct($rangeOldStart, $rangeOldCount, $rangeNewStart, $ran
$this->lines = $lines;
}

/**
* @return int
*/
public function getCount($type)
{
$result = 0;
Expand All @@ -45,31 +57,49 @@ public function getCount($type)
return $result;
}

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

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

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

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

/**
* @return array
*/
public function getLines()
{
return $this->lines;
}

/**
* @return array
*/
public function toArray()
{
return [
Expand All @@ -81,6 +111,11 @@ public function toArray()
];
}

/**
* @param array $array
*
* @return self
*/
public static function fromArray(array $array)
{
return new self($array['range_old_start'], $array['range_old_count'], $array['range_new_start'], $array['range_new_count'], $array['lines']);
Expand Down