Function getInfo

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 2018-12-02 21:38

@param string $value
@param string $field
@param string $selectField

@return array|null
548921
public function getInfo($value = '', $field = 'id', $selectField = '*')
    {
        if (is_array($value) && count($value) > 0) {
            foreach ($value as $f => $v) {
                if (is_array($v)) {
                    $this->db->where($f, $v, self::OPERATOR_IS_IN);
                } else {
                    $this->db->where($f, $v, self::OPERATOR_EQUAL_TO);
                }
            }
        } else {
            $this->db->where($field, $value, self::OPERATOR_EQUAL_TO);
        }
        $result = $this->db->getOne($this->table, $selectField);
        if ($this->db->count > 0) {
            return $result;
        }

        return NULL;
    }
166856
public function get_error_message($field, $value, $validator) {
		return $validator->get_label($field) . ' must match ' . $validator->get_label($this->compare_against);
	}
504704
public function getInfo($option = null)
    {
        if ($option) {
            return curl_getinfo($this->handle, $option);
        } else {
            return curl_getinfo($this->handle);
        }
    }
273421
private function parseArrayable(FieldBuilder $field, $value = [])
    {
        if (is_null($value) || ('0' !== $value && empty($value)))
        {
            if (isset($field['default']))
            {
                return (array)$field['default'];
            }

            return [];
        }

        return (array)$value;
    }
710311
private function getFieldInfo($key, $value): array
    {
        $name = null;
        $options = [];
        if (is_numeric($key) && is_string($value)) {
            $name = $value;
        } else if (is_numeric($key) && is_array($value)) {
            $name = array_shift($value);
            $options = $value;
        } else if (is_string($key)) {
            $name = $key;
            $options = $value;
        }
        return ['name' => $name, 'options' => $options];
    }
86958
protected function getPropertyArrayValue($value, $modelFieldInfo, $forOutput = FALSE) {
    if (!is_object($value)) {
      return $value;
    }
    else {
      if ($modelFieldInfo->isMABIModel) {
        /**
         * @var $subModel \MABI\Model
         */
        $subModel = $value;
        return $subModel->getPropertyArray($forOutput);
      }
      elseif ($modelFieldInfo->type == 'DateTime' || $modelFieldInfo->type == '\DateTime') {
        /**
         * @var $date \DateTime
         */
        $date = $value;
        return $date->getTimestamp();
      }
    }

    return NULL;
  }
370752
public function info($value, ...$args) {
        return call_user_func_array(
            [__CLASS__, 'event'],
            array_merge([self::INFO, $value], $args)
        );
    }
1028485
public function getValue($field) {
        if (is_array($this->values)) {
            return isset($this->values[$field]) ? $this->values[$field] : null;
        }
        if (is_object($this->values)) {
            return $this->values->$field;
        }
        return null;
    }
825026
public function findField($field=null, $options=null)
    {
        if ($field) {
            $this->select($field);
        }
        $ret = $this->find($options);
        
        return $ret ? array_values($ret)[0] : null;
    }
852977
protected function access($values, string $field)
    {
        return isset($values[$field]) ? $values[$field] : null;
    }
1133591
protected function getFieldValue($value, $name)
    {
        if (!is_null($value)) {
            $modelVariable = $this->getSingularVariable($this->modelName);
            return sprintf("(!isset(\$%s->%s) ? '%s' : null)", $modelVariable, $name, $value);
        }
        return 'null';
    }
1143073
public function getFieldValue($field, $data = null)
    {
        if ($data !== null && isset($data[$field])) {
            return $data[$field];
        }
        if (isset($this->{$field})) {
            return $this->{$field};
        }
        return null;
    }
776248
public function selectByValue($value)
	{
		$options = $this->getOptionsByValue($value);

		if ( !$options ) {
			throw new SelectException('Cannot locate option with value: ' . $value, SelectException::TYPE_NOT_FOUND);
		}

		return $this->selectOptions($options, !$this->isMultiple());
	}
445085
protected function parseValue(FieldBuilder $field, $value = null)
    {
        $parsedValue = null;

        // No data found, define a default by field type.
        switch ($field->getFieldType())
        {

            case 'checkbox':
            case 'checkboxes': // @todo remove this checkboxes statement for next major update.
            case 'radio':
            case 'select':
            case 'collection':

                $parsedValue = $this->parseArrayable($field, $value);
                break;

            case 'infinite':

                // Check for the registered fields and their default value if one.
                $parsedValue = $this->parseInfinite($field, $value);
                break;

            // Text
            // Textarea
            // Password
            // Media
            // Editor
            default:
                $parsedValue = $this->parseString($field, $value);
        }

        return $parsedValue;
    }
1004056
protected function getJsonValue($value, $event)
    {
        switch ($event) {
            case ActiveRecord::EVENT_BEFORE_INSERT:
            case ActiveRecord::EVENT_BEFORE_UPDATE:
                if (is_array($value)) {
                    $value = json_encode($value);
                }
                break;
            case ActiveRecord::EVENT_AFTER_FIND:
                $value = @json_encode($value, true) ?: $value;
                break;
        }
        return $value;
    }
696102
public function data($field, $value = null)
    {
        if (is_array($field)) {
            $this->options['data'] = isset($this->options['data']) ? array_merge($this->options['data'], $field) : $field;
        } else {
            $this->options['data'][$field] = $value;
        }

        return $this;
    }
911577
public function getDistinctResult($selectField = '*')
    {
        try {
            $result = $this->db->setQueryOption(['DISTINCT'])->get($this->table, NULL, $selectField);
            $this->debug->debug(__FUNCTION__, 'Result from DB => ' . json_encode($result));

            return $result;
        }
        catch (\Exception $e) {
            $this->debug->error(__FUNCTION__, $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage());

            return NULL;
        }
    }