<commit_before><?php

class ColoCrossing_Resource_NullRoutes extends ColoCrossing_Resource_Abstract
{

	public function __construct(ColoCrossing_Client $client)
	{
		parent::__construct($client, 'null_route', '/null-routes');
	}

	public function findAllByIpAddress($ip_address, array $options = null)
	{
		if(filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
		{
			$options = isset($options) && is_array($options) ? $options : array();
			$options['filters'] = array(
				'ip_address' => $ip_address
			);
		}

		return $this->findAll($options);
	}

	public function add($subnet_id, $ip_address, $comment = '', $expire_date = null)
	{
		$client = $this->getClient();
		$subnet = $client->subnets->find($subnet_id);

		if(empty($subnet) || !$subnet->isIpAddressInSubnet($ip_address))
		{
			return false;
		}

		$data = array(
			'subnet_id' => $subnet_id,
			'ip_address' => $ip_address,
			'comment' => $comment
		);

		if(isset($expire_date) && is_int($expire_date))
		{
			$data['expire_date'] = $expire_date;<commit_msg>Fix Null Route Exp Date Format to ISO 8601<commit_after><?php

class ColoCrossing_Resource_NullRoutes extends ColoCrossing_Resource_Abstract
{

	public function __construct(ColoCrossing_Client $client)
	{
		parent::__construct($client, 'null_route', '/null-routes');
	}

	public function findAllByIpAddress($ip_address, array $options = null)
	{
		if(filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
		{
			$options = isset($options) && is_array($options) ? $options : array();
			$options['filters'] = array(
				'ip_address' => $ip_address
			);
		}

		return $this->findAll($options);
	}

	public function add($subnet_id, $ip_address, $comment = '', $expire_date = null)
	{
		$client = $this->getClient();
		$subnet = $client->subnets->find($subnet_id);

		if(empty($subnet) || !$subnet->isIpAddressInSubnet($ip_address))
		{
			return false;
		}

		$data = array(
			'subnet_id' => $subnet_id,
			'ip_address' => $ip_address,
			'comment' => $comment
		);

		if(isset($expire_date) && is_int($expire_date))
		{
			$data['expire_date'] = date('c', $expire_date);
{'fraction_non_alphanumeric': 0.16288951841359772, 'fraction_numerical': 0.0028328611898017, 'mean_word_length': 5.089080459770115, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '355696', 'n_tokens_mistral': 859, 'n_tokens_neox': 772, 'n_words': 126}