1. Go to this page and download the library: Download litgroup/enumerable library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
litgroup / enumerable example snippets
namespace Acme;
use LitGroup\Enumerable\Enumerable;
final class ColorEnum extends Enumerable
{
/**
* @return self
*/
public static function red()
{
return self::createEnum('red');
}
/**
* @return self
*/
public static function green()
{
return self::createEnum('green');
}
/**
* @return self
*/
public static function blue()
{
return self::createEnum('blue');
}
}
ColorEnum::getValues(); // => Returns array of ColorEnum with index as key
final class MergeRequestStatus extends Enumerable {
public static function open()
{
return self::createEnum('open');
}
public static function approved()
{
return self::createEnum('approved');
}
public static function merged()
{
return self::createEnum('merged');
}
public static function declined()
{
return self::createEnum('declined');
}
/**
* Returns true if status is final.
*
* @return bool
*/
public function isFinal()
{
return $this === self::merged() || $this === self::declined();
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.