/** * @param $expression * @return bool */ public static function translate($expression) { if ((String::isValid($expression) || Number::isValid($expression)) && Collection::existsKey(self::$translationMapping, $expression)) { $expression = self::$translationMapping[$expression]; } return $expression; }
public function __construct($sFileRealPath) { if (Filesystem::isFile($sFileRealPath)) { $this->aDmDictionary = (require $sFileRealPath); foreach ($this->aDmDictionary as $sCategory => $aFeatureList) { foreach ($aFeatureList as $sDmFeature => $sDmFeatureTranslation) { $this->aDmFeature[$sDmFeature] = $sCategory; if (!Number::isValid($sDmFeature)) { $this->aDmTranslation[$sDmFeature] = $sDmFeatureTranslation; } } } } }
function testNumberIsValid() { $this->assertTrue(Number::isValid(500)); }