# depicter/trunk/app/src/Routing/RouteConditionsServiceProvider.php

Depicter — Popup &amp; Slider Builder, version trunk. 45 lines.

- Page: https://pluginprobe.com/plugins/depicter/trunk/code/app/src/Routing/RouteConditionsServiceProvider.php
- Raw: https://pluginprobe.com/plugins/depicter/trunk/raw/app/src/Routing/RouteConditionsServiceProvider.php
- Modified: 2022-06-01T06:26:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/depicter/trunk/code/app/src/Routing/RouteConditionsServiceProvider.php#L10-L20`.

```php
<?php
namespace Depicter\Routing;

use Depicter\Routing\Conditions\EditorOpen;
use Depicter\Routing\Conditions\EditorPreview;
use WPEmerge\ServiceProviders\ServiceProviderInterface;

/**
 * Provide custom route conditions.
 * This is an example class so feel free to modify or remove it.
 */
class RouteConditionsServiceProvider implements ServiceProviderInterface {
	/**
	 * {@inheritDoc}
	 */
	public function register( $container ) {
		$this->registerRouteCondition( $container, 'depicter.condition.editor.open'   , EditorOpen::class );
		$this->registerRouteCondition( $container, 'depicter.condition.editor.preview', EditorPreview::class );
	}

	/**
	 * {@inheritDoc}
	 */
	public function bootstrap( $container ) {
		// Nothing to bootstrap.
	}

	/**
	 * Register a class as a route condition
	 *
	 * @param  \Pimple\Container $container
	 * @param  string            $name
	 * @param  string            $class_name
	 * @return void
	 */
	protected function registerRouteCondition( $container, $name, $class_name ) {
		$container[ WPEMERGE_ROUTING_CONDITION_TYPES_KEY ] = array_merge(
			$container[ WPEMERGE_ROUTING_CONDITION_TYPES_KEY ],
			[
				$name => $class_name,
			]
		);
	}
}

```
