<commit_before><?php 

namespace DJDesrosiers\SilexAnnotations\Annotations;

use Silex\Application;
use DJDesrosiers\SilexAnnotations\Annotations\RouteAnnotation;

/**
 * @Annotation
 * @Target("METHOD")
 */
class Route
{
	/** @var array<Request> */
	public $request;
	
	/** @var array<Convert> */
	public $convert;
	
	/** @var array<Assert> */
	public $assert;
	
	/** @var array<RequireHttp> */
	public $requireHttp;
	
	/** @var array<RequireHttps> */
	public $requireHttps;
	
	/** @var array<Value> */
	public $value;
	
	/** @var array<Host> */
	public $host;
	
	/** @var array<Before> */
	public $before;
	
	/** @var array<After> */
	public $after;
	
	public function __construct(array $values)
	{
		foreach ($values['value'] as $annotation)
		{
			$classPath = explode("\\", get_class($annotation));
			$propertyName = lcfirst(array_pop($classPath));
			$this->{$propertyName}[] = $annotation;
		}
	}
	
	public function process(Application $app, $callback)
	{
		foreach ($this->request as $request)
		{
			$route = $request->process($app, $callback);
			foreach ($this as $annotations)
			{
				foreach ($annotations as $annotation)
				{
					if ($annotation instanceof RouteAnnotation)
					{
						$annotation->process($route);
					}
				}
			}
		}
	}
}<commit_msg>added check for is_array in Route annotation to silence foreach warnings<commit_after><?php 

namespace DJDesrosiers\SilexAnnotations\Annotations;

use Silex\Application;
use DJDesrosiers\SilexAnnotations\Annotations\RouteAnnotation;

/**
 * @Annotation
 * @Target("METHOD")
 */
class Route
{
	/** @var array<Request> */
	public $request;
	
	/** @var array<Convert> */
	public $convert;
	
	/** @var array<Assert> */
	public $assert;
	
	/** @var array<RequireHttp> */
	public $requireHttp;
	
	/** @var array<RequireHttps> */
	public $requireHttps;
	
	/** @var array<Value> */
	public $value;
	
	/** @var array<Host> */
	public $host;
	
	/** @var array<Before> */
	public $before;
	
	/** @var array<After> */
	public $after;
	
	public function __construct(array $values)
	{
		foreach ($values['value'] as $annotation)
		{
			$classPath = explode("\\", get_class($annotation));
			$propertyName = lcfirst(array_pop($classPath));
			$this->{$propertyName}[] = $annotation;
		}
	}
	
	public function process(Application $app, $callback)
	{
		foreach ($this->request as $request)
		{
			$route = $request->process($app, $callback);
			foreach ($this as $annotations)
			{
				if (is_array($annotations))
				{
					foreach ($annotations as $annotation)
					{
						if ($annotation instanceof RouteAnnotation)
						{
							$annotation->process($route);
						}
					}
				}
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.16528614457831325, 'fraction_numerical': 0.0, 'mean_word_length': 3.5187074829931975, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3951929', 'n_tokens_mistral': 1012, 'n_tokens_neox': 861, 'n_words': 186}