Handle model field.

@param string $method
@param string $label

@return bool|Field
486276
protected function handleModelField($method, $label)
    {
        if (in_array($method, $this->model->getAttributes())) {
            return $this->addField($method, $label);
        }

        return false;
    }
496154
protected function checkLabel($label)
    {
        if ($label instanceof ElementInterface) {
            return $label;
        }

        return $this->createLabel($this->translate($label));
    }
942748
public function label(FormView $view, $label = null, array $variables = [])
    {
        if (null !== $label) {
            $variables += ['label' => $label];
        }

        return $this->renderer->searchAndRenderBlock($view, 'label', $variables);
    }
406656
protected function addTextToQuery(string $method, Node $node, ?Field $field = null): void
    {
        if ($node instanceof Word && $node->isStopWord() && $this->ignoreStopWords) {
            return;
        }

        $fieldName = $this->inField() ? $field->getName() : $this->defaultFieldName;

        if ($this->inField() && !$this->inSubquery()) {
            $useBoost = $field->useBoost();
            $boost = $field->getBoost();
            $useFuzzy = $field->useFuzzy();
            $fuzzy = $field->getFuzzy();
        } else {
            $useBoost = $node->useBoost();
            $boost = $node->getBoost();
            $useFuzzy = $node->useFuzzy();
            $fuzzy = $node->getFuzzy();
        }

        /*
         * Look for special chars and if found, enforce fuzzy.
         * todo: review this with more test cases
         */
        if (!$useFuzzy
            && $node instanceof Phrase
            && 'addShould' === $method
            && preg_match('/[^a-zA-Z0-9\s\._-]+/', $node->getValue())
        ) {
            $useFuzzy = true;
            $fuzzy = 1;
        }

        if ($useFuzzy && $node instanceof Phrase) {
            $data = [
                'query'       => $node->getValue(),
                'type'        => Phrase::NODE_TYPE,
                'lenient'     => true,
                'phrase_slop' => $fuzzy,
            ];

            if ($useBoost) {
                $data['boost'] = $boost;
            }

            $query = $this->qb->query()->match();
            $query->setField($fieldName, $data);
        } elseif ($useFuzzy) {
            $query = $this->qb->query()->fuzzy();
            $query->setField($fieldName, $node->getValue());
            $query->setFieldOption('fuzziness', $fuzzy);

            if ($useBoost) {
                $query->setFieldOption('boost', $boost);
            }
        } elseif ($node instanceof Word && $node->hasTrailingWildcard()) {
            $query = $this->qb->query()->wildcard();
            $query->setValue($fieldName, strtolower($node->getValue()) . '*', $useBoost ? $boost : Word::DEFAULT_BOOST);
        } else {
            $data = ['query' => $node->getValue(), 'operator' => 'and', 'lenient' => true];

            if ($useBoost) {
                $data['boost'] = $boost;
            }

            if ($node instanceof Phrase) {
                $data['type'] = Phrase::NODE_TYPE;
            }

            $query = $this->qb->query()->match();
            $query->setField($fieldName, $data);
        }

        $this->addToBoolQuery($method, $fieldName, $query);
    }
1190622
private function addRecordDataAsJsonEncodedField($key, $label)
    {
        if (!empty($this->record[$key])) {
            $this->addField(new Field($label, json_encode($this->record[$key])));
        }
    }
514222
protected function setFields($method = 'addColumn')
    {
        $fields = $this->convertFieldsToArray();

        $template = array_map(array($this, $method), $fields);

        return implode("\n\t\t\t", $template);
    }
1146658
protected function applyRule(MethodNode $method)
    {
        if (preg_match('/^(\_\_|create|get).+/', $method->getName()) !== 0) {
            return;
        }

        $message = sprintf(
            'The factory method %s() violates rule "%s"',
            $method->getName(),
            static::RULE
        );

        $this->addViolation($method, [$message]);
    }
652182
public function method($method)
    {
        if (!$this->isString($method) && !$this->isStringObject($method)) {
            throw new EventManagerException(EventManagerException::MSG_INVALID_ARG, [
                    '$method',
                    'string|StringObject'
                ]
            );
        }
        $this->method = StdObjectWrapper::toString($method);

        return $this;
    }
671016
public function resend($method = null)
    {
        if ($method) {
            if (!in_array($method, array('Email', 'Letter')))
                throw new InvalidFieldValueError("'method' must be either " .
                    "'Email' or 'Letter'");

            return $this->performEvent('resend', array('method' => $method));
        }

        return $this->performEvent('resend');
    }
376973
protected function applyEveryInterfaceMethodMustHaveApiTagAndContractText(MethodNode $method)
    {
        $comment = $method->getComment();
        if (preg_match(
            '(
                \*\s+[{}A-Z0-9\-]+.*\s+
                \*?\s*
                \*\s+@api
            )xi',
            $comment
        )) {
            return;
        }

        $this->addViolation(
            $method,
            [
                sprintf(
                    'The interface method %s does not contain an @api tag or contract text ' .
                    'which violates rule: "%s"',
                    $method->getFullQualifiedName(),
                    self::RULE
                ),
            ]
        );
    }
908108
public function where($label, \Closure $builder)
    {
        $this->input = $this->value;

        $condition = [$builder->bindTo($this)];

        return $this->joinGroup($label, $condition);
    }
206175
public function make($model, $method, $element)
    {
        $this->tableInfo = $this->getTableInfo($model);

        $type = 'generic';
        if (preg_match('/^ul|li|ol$/i', $element))
        {
            $element = 'li';
            $type = 'list';
        }

        $output = $this->render($type, $method, $model, $element);
        $this->printOutput($output);
    }
211446
public function instanceHandle($mock, string $label = ''): InstanceHandle
    {
        if ($mock instanceof InstanceHandle) {
            return $mock;
        }

        if (!$mock instanceof Mock) {
            throw new InvalidMockException($mock);
        }

        $class = new ReflectionClass($mock);

        $handleProperty = $class->getProperty('_handle');
        $handleProperty->setAccessible(true);

        $handle = @$handleProperty->getValue($mock);

        if ($handle) {
            return $handle;
        }

        $handle = new InstanceHandle(
            $mock,
            (object) [
                'defaultAnswerCallback' =>
                    [StubData::class, 'returnsEmptyAnswerCallback'],
                'stubs' => (object) [],
                'isRecording' => true,
                'label' => $label,
            ],
            $this->stubFactory,
            $this->stubVerifierFactory,
            $this->emptyValueFactory,
            $this->assertionRenderer,
            $this->assertionRecorder,
            $this->invoker
        );

        @$handleProperty->setValue($mock, $handle);

        return $handle;
    }
1360854
protected function setErrorRequired($field, $label)
    {
        $error = $this->translation->text('@field is required', array('@field' => $label));
        return $this->setError($field, $error);
    }
473579
public static function log($Object, $Label=null)
    {
        return self::send($Object, $Label, FirePHP::LOG);
    }
1345333
function field($label, $fieldname, $fieldtype) {
		// field type loaders
		$fieldtypes = $this->confs->read('ran/htmlform')['fieldtypes'];

		if (isset($fieldtypes[$fieldtype])) {
			$instance = $fieldtypes[$fieldtype]($this, $this->confs);
		}
		else { # assume specialized class definition with no fieldtype loader
			$class = \hlin\PHP::pnn('ran.'.ucfirst($fieldtype).'Field');
			$instance = $class::instance($this->confs);
		}

		// configure and return
		return $instance
			->set('id', $this->signature($this->fieldcounter++))
			->set('name', $fieldname)
			->form_is($this)
			->fieldlabel_is($label)
			->fieldtemplate_is($this->fieldtemplate($fieldtype))
			->fieldconfigurer_is($this->fieldconfigurer($fieldtype))
			->hintrenderer_is($this->hintrenderer($fieldtype))
			->errorrenderer_is($this->errorrenderer($fieldtype))
			->adderrors($this->errors($fieldname));
	}
278082
protected function checkManagerMethod($method, $message)
    {
        $this->explainer->line($message);

        return $this->executeStrategyMethod('Check', $method);
    }