for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPSemVerChecker\SemanticVersioning;
class Level
{
const NONE = 0; // TODO: Get rid of this *level* <[email protected]>
const PATCH = 1;
const MINOR = 2;
const MAJOR = 3;
/**
* @param string $order
* @return array
*/
public static function asList($order = 'asc')
$levels = [
self::PATCH,
self::MINOR,
self::MAJOR,
];
if ($order === 'asc') {
return $levels;
} else {
rsort($levels);
}
* @param int $level
* @return string
public static function toString($level)
$mapping = [
self::NONE => 'NONE',
self::PATCH => 'PATCH',
self::MINOR => 'MINOR',
self::MAJOR => 'MAJOR',
return $mapping[$level];
* @param string $level
* @return int
public static function fromString($level)
'NONE' => self::NONE,
'PATCH' => self::PATCH,
'MINOR' => self::MINOR,
'MAJOR' => self::MAJOR,
return $mapping[strtoupper($level)];