-
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.
Merge pull request #55 from krlxfm/supporting-views
"Lincoln" Supporting Views. Yes, we're ignoring Code Climate again. Will be fixed later, see #45, #46, #47, and #48 for ongoing issues to be resolved later. (Famous last words.)
- Loading branch information
Showing
25 changed files
with
1,070 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace KRLX; | ||
|
||
class Priority | ||
{ | ||
public $terms = 0; | ||
public $year = 0; | ||
|
||
/** | ||
* Get the string representation of this priority. | ||
* | ||
* @return string | ||
*/ | ||
public function display() | ||
{ | ||
$terms = ''; | ||
if ($this->terms >= count(config('defaults.priority.terms'))) { | ||
$terms = config('defaults.priority.default'); | ||
} else { | ||
$terms = config('defaults.priority.terms')[$this->terms]; | ||
} | ||
|
||
$year = ''; | ||
if ($this->year >= count(config('defaults.status_codes'))) { | ||
$year = $this->year; | ||
} else { | ||
$year = config('defaults.status_codes')[$this->year]; | ||
} | ||
|
||
return $terms.' | '.$year; | ||
} | ||
|
||
/** | ||
* Get the HTML representation of this priority. | ||
* | ||
* @return string | ||
*/ | ||
public function html() | ||
{ | ||
return str_replace(' | ', ' • ', $this->display()); | ||
} | ||
|
||
/** | ||
* Get the zone letter corresponding to this priority's terms. | ||
* | ||
* @return string | ||
*/ | ||
public function zone() | ||
{ | ||
$letters = range('J', 'A'); | ||
|
||
return $this->terms < count($letters) ? $letters[$this->terms] : 'A'; | ||
} | ||
} |
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
Oops, something went wrong.