Skip to content

Commit

Permalink
Update codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
wapmorgan committed May 16, 2018
1 parent d5b3dcc commit a0db8f4
Show file tree
Hide file tree
Showing 23 changed files with 495 additions and 274 deletions.
3 changes: 3 additions & 0 deletions src/CasesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public static function canonizeCase($case)
}
}

/**
* @return array
*/
public static function getAllCases()
{
return [
Expand Down
5 changes: 5 additions & 0 deletions src/CurrenciesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

trait CurrenciesHelper
{
/**
* @param $currency
* @return string
* @throws Exception
*/
public static function canonizeCurrency($currency)
{
switch ($currency) {
Expand Down
17 changes: 11 additions & 6 deletions src/English/CardinalNumeralGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class CardinalNumeralGenerator extends NumeralGenerator
{
public static $words = array(
public static $words = [
1 => 'one',
2 => 'two',
3 => 'three',
Expand Down Expand Up @@ -33,23 +33,28 @@ class CardinalNumeralGenerator extends NumeralGenerator
70 => 'seventy',
80 => 'eighty',
90 => 'ninety',
);
];

public static $exponents = array(
public static $exponents = [
'100' => 'hundred',
'1000' => 'thousand',
'1000000' => 'million',
'1000000000' => 'billion',
'1000000000000' => 'trillion',
);
];

public static function getCases($number)
{
}

public static function getCase($number, $case)
{
}

/**
* @param $number
* @return mixed|string
*/
public static function generate($number)
{
// simple numeral
Expand All @@ -58,8 +63,8 @@ public static function generate($number)
}
// compound numeral
else {
$parts = array();
$words = array();
$parts = [];
$words = [];

foreach (array_reverse(self::$exponents, true) as $word_number => $word) {
if ($number >= $word_number) {
Expand Down
17 changes: 11 additions & 6 deletions src/English/NounPluralization.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class NounPluralization extends \morphos\NounPluralization
{
private static $exceptions = array(
private static $exceptions = [
'chief' => 'chiefs',
'basis' => 'bases',
'crisis' => 'crises',
Expand All @@ -20,9 +20,9 @@ class NounPluralization extends \morphos\NounPluralization
'ox' => 'oxen',
'goose' => 'geese',
'mouse' => 'mice'
);
];

private static $without_paired_form = array(
private static $without_paired_form = [
'knowledge',
'progress',
'advise',
Expand All @@ -31,10 +31,15 @@ class NounPluralization extends \morphos\NounPluralization
'scissors',
'spectacles',
'trousers',
);
];

public static $consonants = array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'x', 'z', 'w');
public static $consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'x', 'z', 'w'];

/**
* @param $word
* @param int $count
* @return string
*/
public static function pluralize($word, $count = 2)
{
if ($count == 1) {
Expand All @@ -48,7 +53,7 @@ public static function pluralize($word, $count = 2)
return self::$exceptions[$word];
}

if (in_array(S::slice($word, -1), array('s', 'x')) || in_array(S::slice($word, -2), array('sh', 'ch'))) {
if (in_array(S::slice($word, -1), ['s', 'x']) || in_array(S::slice($word, -2), array('sh', 'ch'))) {
return $word.'es';
} elseif (S::slice($word, -1) == 'o') {
return $word.'es';
Expand Down
13 changes: 9 additions & 4 deletions src/English/OrdinalNumeralGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

class OrdinalNumeralGenerator extends NumeralGenerator
{
protected static $words = array(
protected static $words = [
1 => 'first',
2 => 'second',
3 => 'third',
5 => 'fifth',
8 => 'eighth',
9 => 'ninth',
12 => 'twelfth',
);
];

public static function getCases($number)
{
Expand All @@ -22,6 +22,11 @@ public static function getCase($number, $case)
{
}

/**
* @param $number
* @param bool $short
* @return string
*/
public static function generate($number, $short = false)
{
// simple numeral
Expand All @@ -40,8 +45,8 @@ public static function generate($number, $short = false)
}
// compound numeral
else {
$parts = array();
$words = array();
$parts = [];
$words = [];

$original_number = $number;

Expand Down
5 changes: 5 additions & 0 deletions src/English/TimeSpeller.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class TimeSpeller extends \morphos\TimeSpeller
self::SECOND => 'second',
];

/**
* @param $count
* @param $unit
* @return string
*/
public static function spellUnit($count, $unit)
{
if (!isset(self::$units[$unit])) {
Expand Down
5 changes: 5 additions & 0 deletions src/English/functions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php
namespace morphos\English;

/**
* @param int $count
* @param string $word
* @return string
*/
function pluralize($count, $word)
{
return $count.' '.NounPluralization::pluralize($word, $count);
Expand Down
6 changes: 6 additions & 0 deletions src/MoneySpeller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ abstract class MoneySpeller implements Currency
const CLARIFICATION_FORMAT = 'clarification';
const DUPLICATION_FORMAT = 'duplication';

/**
* @abstract
* @param float $value
* @param string $currency
* @param string $format
*/
public static function spell($value, $currency, $format = self::NORMAL_FORMAT) {}
}
Loading

0 comments on commit a0db8f4

Please sign in to comment.