private static function checkArgs_checkArray($num, array $type, $arg, $iate) { $iate += 1; $types = array('greater than', 'less than', 'equal to'); if (!in_array($type[0], $types)) { throw new Iate($i, 'an existing type', $type[0], 1); } if ($type[0] === 'greater than' && Misc::isInt($type[1])) { if ($arg <= $type[1]) { throw new Iate($num, "greater than {$type[1]}", $arg, $iate); } } else { if ($type[0] === 'less than' && Misc::isInt($type[1])) { if ($arg >= $type[1]) { throw new Iate($num, "less than {$type[1]}", $arg, $iate); } } else { if ($type[0] === 'equal to' && $type[1] != $arg) { throw new Iate($num, "equal to {$type[1]}", $arg, $iate); } } } }
public static function checkFilesExtension($filename, array $exts, $value_if_empty = true, $depth = 0, $iate = 0) { Debug::checkArgs(0, 4, 'int', $depth, 4, array('greater than', -1), $depth, 5, 'int', $iate, 5, array('greater than', -1), $iate); Debug::checkArgs($iate, 1, 'string', $filename); if (Misc::isEmpty($exts)) { return (bool) $value_if_empty; } foreach ($exts as $ext) { if (mb_substr($filename, -mb_strlen($ext)) === $ext) { return true; } } return false; }