-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
BUPH-145 | Shared Templates
- Loading branch information
Showing
74 changed files
with
1,937 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fab/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neighborhoods\BuphaloTest\SharedTemplates\DOR\Version; | ||
|
||
class Car implements CarInterface | ||
{ | ||
/** @var int */ | ||
private $year; | ||
|
||
/** @var string */ | ||
private $make; | ||
|
||
/** @var string */ | ||
private $model; | ||
|
||
public function getYear(): int | ||
{ | ||
if ($this->year === null) { | ||
throw new \LogicException('year has not been set'); | ||
} | ||
|
||
return $this->year; | ||
} | ||
|
||
public function setYear(int $year): CarInterface | ||
{ | ||
if ($this->year !== null) { | ||
throw new \LogicException('year has already been set'); | ||
} | ||
|
||
$this->year = $year; | ||
|
||
return $this; | ||
} | ||
|
||
public function getMake(): string | ||
{ | ||
if ($this->make === null) { | ||
throw new \LogicException('make has not been set'); | ||
} | ||
|
||
return $this->make; | ||
} | ||
|
||
public function setMake(string $make): CarInterface | ||
{ | ||
if ($this->make !== null) { | ||
throw new \LogicException('make has already been set'); | ||
} | ||
|
||
$this->make = $make; | ||
|
||
return $this; | ||
} | ||
|
||
public function getModel(): string | ||
{ | ||
if ($this->model === null) { | ||
throw new \LogicException('model has not been set'); | ||
} | ||
|
||
return $this->model; | ||
} | ||
|
||
public function setModel(string $model): CarInterface | ||
{ | ||
if ($this->model !== null) { | ||
throw new \LogicException('model has already been set'); | ||
} | ||
|
||
$this->model = $model; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
services: | ||
Neighborhoods\BuphaloTest\SharedTemplates\DOR\Version\CarInterface: | ||
class: Neighborhoods\BuphaloTest\SharedTemplates\DOR\Version\Car | ||
public: false | ||
shared: false |
46 changes: 46 additions & 0 deletions
46
tests/v2/SharedTemplates/control/DOR/Version/Car/AwareTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neighborhoods\BuphaloTest\SharedTemplates\DOR\Version\Car; | ||
|
||
use LogicException; | ||
use Neighborhoods\BuphaloTest\SharedTemplates\DOR\Version\CarInterface; | ||
|
||
trait AwareTrait | ||
{ | ||
protected $DORVersionCar; | ||
|
||
public function setDORVersionCar(CarInterface $Car): self | ||
{ | ||
if ($this->hasDORVersionCar()) { | ||
throw new LogicException('DORVersionCar is already set.'); | ||
} | ||
$this->DORVersionCar = $Car; | ||
|
||
return $this; | ||
} | ||
|
||
protected function getDORVersionCar(): CarInterface | ||
{ | ||
if (!$this->hasDORVersionCar()) { | ||
throw new LogicException('DORVersionCar is not set.'); | ||
} | ||
|
||
return $this->DORVersionCar; | ||
} | ||
|
||
protected function hasDORVersionCar(): bool | ||
{ | ||
return isset($this->DORVersionCar); | ||
} | ||
|
||
protected function unsetDORVersionCar(): self | ||
{ | ||
if (!$this->hasDORVersionCar()) { | ||
throw new LogicException('DORVersionCar is not set.'); | ||
} | ||
unset($this->DORVersionCar); | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.