for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Obsidian;
use Exception;
use Obsidian\Support\Arr;
use Obsidian\Routing\Conditions\ConditionInterface;
/**
* Extend built-in functionality
*
* @codeCoverageIgnore
*/
class Extend {
* Dictionary of extensions
* @var array
protected static $extensions = [];
* Get extensions for type
* @param string $type
* @return array
public static function get( $type ) {
return Arr::get( static::$extensions, $type );
}
* Set extension for type, with name and class name
* @throws Exception
* @param string $name
* @param string $class_name
* @return void
public static function set( $type, $name, $class_name ) {
if ( Framework::isBooted() ) {
throw new Exception( 'Extensions must be registered before Obsidian is booted.' );
Arr::set( static::$extensions, $type . '.' . $name, $class_name );
* Register a route condition
public static function routeCondition( $name, $class_name ) {
static::set( ConditionInterface::class, $name, $class_name );