@param string $field
@param array  $global

@throws InvalidArgumentException
510479
public function addProperty($field, $global)
    {
        if (!isset($global['type'])) {
            throw new InvalidArgumentException('Property type must be string');
        }

        if (!\is_string($global['type'])) {
            throw new InvalidArgumentException('Property type must be string');
        }

        if (!\is_string($field)) {
            throw new InvalidArgumentException('Property name must be string');
        }

        if (isset($this->properties[$field])) {
            throw new InvalidArgumentException('Property was defined more than once');
        }

        $this->properties[$field] = $this->convertToCType($global['type']);
    }
196134
public function load(Mage_Core_Model_Abstract $object, $value, $field = null)
    {
        if (!$object instanceof Aoe_Scheduler_Model_Job) {
            throw new InvalidArgumentException(sprintf("Expected object of type 'Aoe_Scheduler_Model_Job' got '%s'", get_class($object)));
        }

        /** @var Aoe_Scheduler_Model_Job $object */

        if (!empty($field)) {
            throw new InvalidArgumentException('Aoe_Scheduler_Model_Resource_Job cannot load by any field except the job code.');
        }

        if (empty($value)) {
            $this->setModelFromJobData($object, array());
            $object->setJobCode('');
            $object->setXmlJobData(array());
            $object->setDbJobData(array());
            return $this;
        }

        $xmlJobData = $this->getJobDataFromXml($value);
        $dbJobData = $this->getJobDataFromDb($value);
        $jobData = array_merge($xmlJobData, $this->getJobDataFromConfig($value, true), $dbJobData);

        $this->setModelFromJobData($object, $jobData);
        $object->setJobCode($value);
        $object->setXmlJobData($xmlJobData);
        $object->setDbJobData($dbJobData);

        $this->unserializeFields($object);
        $this->_afterLoad($object);

        return $this;
    }
726716
protected function checkArgumentsAndOptions(CommandInterface $command, array $providedArguments, array $globalOptions): void
	{
		if($command->isStrict())
		{
			$this->checkForInvalidArguments($command, $providedArguments, $globalOptions);
		}

		$this->checkForMissingArguments($command, $providedArguments);

		$this->checkForMissingOptions($command, $providedArguments);
	}
632260
public static function setFieldValue($instance, $fieldName, $value)
    {
        $setterMethodName = 'set'.ucfirst($fieldName);

        try {
            $ref = new \ReflectionClass($instance);
            $ref->getMethod($setterMethodName);
        } catch (\Exception $e) {
            throw new \InvalidArgumentException(sprintf('The setter method "%s" that should be used for property "%s" seems not to exist. Please check your spelling in the command option or in your implementation class.', $setterMethodName, $fieldName));
        }

        $instance->$setterMethodName($value);
    }
1011570
def add_global(self, globalvalue):
        
        assert globalvalue.name not in self.globals
        self.globals[globalvalue.name] = globalvalue
666251
function create_field( $field )
	{
		// global
		global $post;
		
		
		// vars
		$args = array(
			'numberposts' => -1,
			'post_type' => null,
			'orderby' => 'title',
			'order' => 'ASC',
			'post_status' => array('publish', 'private', 'draft', 'inherit', 'future'),
			'suppress_filters' => false,
		);
		
		
		// load all post types by default
		if( in_array('all', $field['post_type']) )
		{
			$field['post_type'] = apply_filters('acf/get_post_types', array());
		}
		
		
		// create tax queries
		if( ! in_array('all', $field['taxonomy']) )
		{
			// vars
			$taxonomies = array();
			$args['tax_query'] = array();
			
			foreach( $field['taxonomy'] as $v )
			{
				
				// find term (find taxonomy!)
				// $term = array( 0 => $taxonomy, 1 => $term_id )
				$term = explode(':', $v); 
				
				
				// validate
				if( !is_array($term) || !isset($term[1]) )
				{
					continue;
				}
				
				
				// add to tax array
				$taxonomies[ $term[0] ][] = $term[1];
				
			}
			
			
			// now create the tax queries
			foreach( $taxonomies as $k => $v )
			{
				$args['tax_query'][] = array(
					'taxonomy' => $k,
					'field' => 'id',
					'terms' => $v,
				);
			}
		}
		
		
		// Change Field into a select
		$field['type'] = 'select';
		$field['choices'] = array();
		
		
		foreach( $field['post_type'] as $post_type )
		{
			// set post_type
			$args['post_type'] = $post_type;
			
			
			// set order
			$get_pages = false;
			if( is_post_type_hierarchical($post_type) && !isset($args['tax_query']) )
			{
				$args['sort_column'] = 'menu_order, post_title';
				$args['sort_order'] = 'ASC';
				
				$get_pages = true;
			}
			
			
			// filters
			$args = apply_filters('acf/fields/post_object/query', $args, $field, $post);
			$args = apply_filters('acf/fields/post_object/query/name=' . $field['_name'], $args, $field, $post );
			$args = apply_filters('acf/fields/post_object/query/key=' . $field['key'], $args, $field, $post );
			
			
			if( $get_pages )
			{
				$posts = get_pages( $args );
			}
			else
			{
				$posts = get_posts( $args );
			}
			
			
			if($posts) {
				
				foreach( $posts as $p ) {
					
					// title
					$title = get_the_title( $p->ID );
					
					
					// empty
					if( $title === '' ) {
						
						$title = __('(no title)', 'acf');
						
					}
					
					
					// ancestors
					if( $p->post_type != 'attachment' ) {
						
						$ancestors = get_ancestors( $p->ID, $p->post_type );
						
						$title = str_repeat('- ', count($ancestors)) . $title;
						
					}
					
					
					// status
					if( get_post_status( $p->ID ) != "publish" ) {
						
						$title .= ' (' . get_post_status( $p->ID ) . ')';
						
					}
					
					
					// WPML
					if( defined('ICL_LANGUAGE_CODE') ) {
						
						$title .= ' (' . ICL_LANGUAGE_CODE . ')';
						
					}
					
					
					// filters
					$title = apply_filters('acf/fields/post_object/result', $title, $p, $field, $post);
					$title = apply_filters('acf/fields/post_object/result/name=' . $field['_name'] , $title, $p, $field, $post);
					$title = apply_filters('acf/fields/post_object/result/key=' . $field['key'], $title, $p, $field, $post);
					
					
					// add to choices
					if( count($field['post_type']) == 1 )
					{
						$field['choices'][ $p->ID ] = $title;
					}
					else
					{
						// group by post type
						$post_type_object = get_post_type_object( $p->post_type );
						$post_type_name = $post_type_object->labels->name;
					
						$field['choices'][ $post_type_name ][ $p->ID ] = $title;
					}
					
					
				}
				// foreach( $posts as $post )
			}
			// if($posts)
		}
		// foreach( $field['post_type'] as $post_type )
		
		
		// create field
		do_action('acf/create_field', $field );
	}
627752
public function whereCmp($field, $operator, $value)
    {
        if ($operator === '=') {
            $this->_filters[] = [$field => $this->normalizeValue($field, $value)];
        } elseif ($operator === '~=') {
            if ($this->_types && !isset($this->_types[$field])) {
                throw new InvalidArgumentException(['`:field` field is not exist in `:collection` collection',
                    'field' => $field,
                    'collection' => $this->getSource()
                ]);
            }

            if (is_scalar($value)) {
                if (is_int($value)) {
                    $this->_filters[] = [$field => ['$in' => [(string)$value, (int)$value]]];
                } elseif (is_float($value)) {
                    $this->_filters[] = [$field => ['$in' => [(string)$value, (float)$value]]];
                } else {
                    $this->_filters[] = [$field => ['$in' => [(string)$value, (int)$value, (float)$value]]];
                }
            } else {
                throw new InvalidValueException(['`:operator` operator is not  valid: value must be scalar value', 'operator' => $operator]);
            }
        } else {
            $operator_map = ['>' => '$gt', '>=' => '$gte', '<' => '$lt', '<=' => '$lte', '!=' => '$ne', '<>' => '$ne'];
            if (!isset($operator_map[$operator])) {
                throw new InvalidValueException(['unknown `:operator` operator', 'operator' => $operator]);
            }
            $this->_filters[] = [$field => [$operator_map[$operator] => $this->normalizeValue($field, $value)]];
        }

        return $this;
    }
1268991
public function orderBy($field, $order)
    {
        if (!in_array($field, $this->getAvailableFields())) {
            throw new \InvalidArgumentException(sprintf('Field "%s" not supported, prefer: %s', $field, implode(', ', $this->getAvailableFields())));
        }

        if (!in_array($order, array('ASC', 'DESC'))) {
            throw new \InvalidArgumentException(sprintf('Order "%s" not supported, prefer: ASC or DESC', $order));
        }

        $this->sort = array($field, $order);

        return $this;
    }
479303
public function doReplace($input, $data, $global)
    {
        preg_match_all(
            '/%(?P<reference>[^%]+)%/',
            $input,
            $matches
        );

        if (false === empty($matches['reference'])) {
            foreach ($matches['reference'] as $reference) {
                try {
                    $ref = $this->resolveReference($reference, $data);
                } catch (InvalidReferenceException $exception) {
                    if (empty($global)) {
                        throw $exception;
                    }

                    $ref = $this->resolveReference($reference, $global);
                }

                if ((false === is_null($ref))
                    && (false === is_scalar($ref))
                    && (false == preg_match('/^%(?:[^%]+)%$/', $input))) {
                    throw InvalidReferenceException::format(
                        'The non-scalar reference "%s" cannot be used inline.',
                        "%$reference%"
                    );
                }

                if ("%$reference%" === $input) {
                    $input = $ref;
                } else {
                    $input = str_replace("%$reference%", $ref, $input);
                }
            }
        }

        return $input;
    }
401175
public static function setSimpleDecimalFields(
        array $fields,
        ClassMetadataBuilder $builder,
        $default = null
    ): void {
        if (null !== $default && !\is_string($default)) {
            throw new \InvalidArgumentException(
                'Invalid default value ' . $default
                . ' with type ' . self::getType($default)
            );
        }
        if (null !== $default && !is_numeric($default)) {
            throw new \InvalidArgumentException(
                'Invalid default value ' . $default
                . ', even though it is a string, it must be numeric '
            );
        }
        foreach ($fields as $field) {
            $fieldBuilder = new FieldBuilder(
                $builder,
                [
                    'fieldName' => $field,
                    'type'      => Type::DECIMAL,
                    'default'   => (string)(float)$default,
                ]
            );
            $fieldBuilder
                ->columnName(self::getColumnNameForField($field))
                ->nullable(null === $default)
                ->precision(Database::MAX_DECIMAL_PRECISION)
                ->scale(Database::MAX_DECIMAL_SCALE)
                ->build();
        }
    }
308018
function log($level, $message, array $context = []): void {
    if (!isset(static::$levels[$level])) {
      $values = implode(', ', (new \ReflectionClass(LogLevel::class))->getConstants());
      throw new InvalidArgumentException("Invalid enumerable value '$level'. Please make sure it is among ($values).");
    }

    \Yii::getLogger()->log($message, static::$levels[$level], __METHOD__);
  }
12726
private function assertValidFields($fields)
    {
        if(!isset($fields)) {
            throw new InvalidArgumentException("Fields are empty");
        }

        foreach($fields as $field) {
            if(count(explode('.', $field['key'])) != 2) {
                throw new InvalidArgumentException('Key has wrong format');
            }
        }
    }
751631
public function set(array $fields = null): Update
    {
        if (!\is_array($fields)) {
            throw new InvalidArgumentException('$fields has to be an array or a string');
        }

        $this->namesClass->addAliases(\array_keys($fields));
        foreach ($fields as $name => $value) {
            $this->fields[] = \sprintf(
                '%s=%s',
                $name,
                $this->escapeClass->escape($value, $this->namesClass->getAliases())
            );
        }

        return $this;
    }
1371280
private function checkFieldIndex($fieldIndex): void
    {
        if (ctype_digit((string)$fieldIndex)) {
            if ($fieldIndex < 0 || $fieldIndex >= $this->numFields) {
                throw new exceptions\InvalidArgumentException(sprintf(
                    "%s: field number %d is not within range 0..%d",
                    __METHOD__,
                    $fieldIndex,
                    $this->numFields - 1
                ));
            }

        } elseif (is_string($fieldIndex)) {
            if (!isset($this->namesHash[$fieldIndex])) {
                throw new exceptions\InvalidArgumentException(
                    sprintf("%s: field name '%s' is not present", __METHOD__, $fieldIndex)
                );
            }

        } else {
            throw new exceptions\InvalidArgumentException(sprintf(
                "%s expects a field number or a field name, '%s' given",
                __METHOD__,
                is_object($fieldIndex) ? get_class($fieldIndex) : gettype($fieldIndex)
            ));
        }
    }
391661
public static function load($file, $global = true)
    {
        if (isset(static::$_content[$global . $file])) {
            return static::$_content[$global . $file];
        } else {
            $filePath =
                (
                $global === true
                    ? Cml::getApplicationDir('global_config_path')
                    : Cml::getApplicationDir('apps_path')
                    . '/' . ($global === false ? Cml::getContainer()->make('cml_route')->getAppName() : $global) . '/'
                    . Cml::getApplicationDir('app_config_path_name')
                )
                . '/' . ($global === true ? self::$isLocal . DIRECTORY_SEPARATOR : '') . $file . '.php';

            if (!is_file($filePath)) {
                throw new ConfigNotFoundException(Lang::get('_NOT_FOUND_', $filePath));
            }
            static::$_content[$global . $file] = Cml::requireFile($filePath);
            return static::$_content[$global . $file];
        }
    }
318771
public function onGenerateFormField($field, $nb) {
		if ($field instanceof HtmlFormInput) {
			if ($field->getDataField ()->getProperty ( 'type' ) == "datetime-local") {
				$v = $field->getDataField ()->getProperty ( 'value' );
				$field->getDataField ()->setValue ( date ( "Y-m-d\TH:i:s", strtotime ( $v ) ) );
			}
		}
		return;
	}
130744
private function assertValidField(string $field) : void
    {
        if (! isset($this->entityChangeSet[$field])) {
            throw new InvalidArgumentException(sprintf(
                'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.',
                $field,
                get_class($this->getObject())
            ));
        }
    }