Return valid form data
@param $content
@return array
171960
protected function _defaultData($content)
    {
        $content = @unserialize($content);
        return (empty($content) || !is_array($content)) ? [] : $content;
    }
447551
protected function _defaultData($content)
    {
        $content = @unserialize($content);
        if (empty($content) || !is_a($content, \stdClass::class)) {
            $content = new \stdClass;
        }
        $content->file = empty($content->file) ? '' : $content->file;
        $content->title = empty($content->title) ? '' : $content->title;
        return $content;
    }
1127540
public function validate($content)
    {
        if (!$content) {
            return false;
        }
        if (preg_match('/[A-Z]/', $content)) {
            return false;
        } elseif (mb_strpos($content, self::PARSE_DELIMITER) === 0) {
            $this->errorMsg = self::PARSE_DELIMITER . ' is not allowed to be at the beginning of the callname';

            return false;
        } elseif (mb_strpos($content, self::PARSE_DELIMITER) == (strlen($content) - 1)) {
            $this->errorMsg = self::PARSE_DELIMITER . ' is not allowed to be at the end of the callname';

            return false;
        } elseif (preg_match($this->invalidCharacters, $content)) {
            $this->errorMsg = $this->invalidCharacters . ' are not allowed to be in the callname';

            return false;
        }

        return true;
    }
926972
public function parse($content)
    {
        if (!$content) {
            return [];
        }

        if (strpos($content, '@validator') === false) {
            return[];
        }


        $validatorSet = [];
        if (preg_match_all(self::ANNOTATION_PATTERN, $content, $matches)) {

            $typeBoolean = new InterpreterTypeBoolean();
            // simplify the matches and return only the parameter list
            $set = [];
            foreach ($matches[1] as $validator) {
                // if there is no validator name why even bother
                if (preg_match(self::VALIDATOR_NAME_PATTERN, $validator, $match)) {
                    $set[self::INDEX_INTERFACE] = $match[1];
                } else {
                    continue;
                }

                if (preg_match(self::VALIDATOR_OPERATOR_PATTERN, $validator, $match)) {
                    $set[self::INDEX_OPERATOR] = $match[1];
                } else {
                    $set[self::INDEX_OPERATOR] = self::DEFAULT_OPERATOR;
                }

                if (preg_match(self::VALIDATOR_MANDATORY_PATTERN, $validator, $match)) {
                    $set[self::INDEX_MANDATORY] = $typeBoolean->execute($match[1]);
                } else {
                    $set[self::INDEX_MANDATORY] = self::DEFAULT_MANDATORY;
                }

                if (preg_match(self::VALIDATOR_EXPECTATION_PATTERN, $validator, $match)) {
                    $set[self::INDEX_EXPECTED] = $typeBoolean->execute($match[1]);
                } else {
                    $set[self::INDEX_EXPECTED] = self::DEFAULT_EXPECTATION;
                }

                // add the set
                if ($set) {
                    array_push($validatorSet, $set);
                }
            }
        }

        return $validatorSet;
    }
543660
public function getHeaders(string $content): array
    {
        \preg_match_all('/(?<=["\'])[^="\']*\.css(\.gzi?p?)?(\?\d*)?(?=["\'])/', $content, $cssFiles);
        $paths = $this->streamlineFilePaths((array)$cssFiles[0]);

        return $this->mapPathsWithType($paths, 'style');
    }
961785
public function arrayToJson($content = null)
    {
        if ($this->getJsonEncodeArray() && is_array($content)) {
            $this->header('Content-Type: application/json');
            return json_encode($content);
        }

        return $content;
    }
1277786
protected function correct($content)
    {
        $corrections = $this->corrections;
        if (!empty($corrections)) {
            foreach ($corrections as $pattern => $replacement) {
                $reg_count = 0;

                /**
                 * @var $content
                 * reassign $content to corrected $content as long as corrections
                 * rules array loop
                 */
                $content = preg_replace('/' .
                    $pattern .
                    '/us', $replacement, $content, -1, $reg_count);
            }
        }
        return $content;
    }
686730
protected function _parseFormEntities($content) {
		preg_match_all('/\$this-\>Form->create\(\$(\w+)\W/i', $content, $matches);
		if (empty($matches[1])) {
			return [];
		}

		$result = [];

		$entities = array_unique($matches[1]);
		foreach ($entities as $entity) {
			$entityName = Inflector::camelize(Inflector::underscore($entity));

			$className = App::className(($this->getConfig(static::CONFIG_PLUGIN) ? $this->getConfig(static::CONFIG_PLUGIN) . '.' : '') . $entityName, 'Model/Entity');
			if (!$className) {
				continue;
			}

			$annotation = AnnotationFactory::createOrFail(VariableAnnotation::TAG, '\\' . $className, '$' . $entity);

			$result[$entity] = $annotation;
		}

		return $result;
	}
21079
public function data($content, $options = [])
    {
        if (isset($options['returnAll']) && $options['returnAll']) {
            return BlockSelectOption::getOptionsArray($this->_block->id);
        }
        return parent::data($content);
    }
551431
public function parseContent($content)
    {
        $cto = $this->getContentTypeObject();
        if (!empty($cto)) {
            return $cto->parseContent($content);
        } else {
            return $content;
        }
    }
1249396
protected function formatContent($content)
    {
        if ($this->request->method == 'HEAD') {
            return (object) $this->headers;
        }

        if ($this->isXml()) {
            return json_decode($this->parseXml($content));
        }

        if ($this->isJson()) {
            return json_decode($content);
        }
    }
205098
protected function _getUsedModels($content) {
		preg_match_all('/\$this-\>loadModel\(\'([a-z.\/]+)\'/i', $content, $matches);
		if (empty($matches[1])) {
			return [];
		}

		$models = $matches[1];

		return array_unique($models);
	}
929942
protected function serialize($content)
    {
        if (!empty($content)) {
            if (is_object($content)) {
                $content = $this->serializer->serialize($content, 'json');
            }
        }

        return $content;
    }
54718
public static function parse($content)
    {
        $matter = array();

        $text = str_replace(PHP_EOL, $id = uniqid(), $content);

        $regex = '/^---' . $id . '(.*?)' . $id . '---/';

        if (preg_match($regex, $text, $matches) === 1) {
            $yaml = str_replace($id, PHP_EOL, $matches[1]);

            $matter = (array) Yaml::parse(trim($yaml));

            $body = str_replace($matches[0], '', $text);

            $content = str_replace($id, PHP_EOL, $body);
        }

        return array($matter, (string) trim($content));
    }
573719
public function getPosts(Content $content)
    {
        if (isset($this->site->categories[$content->id])) {
            return $this->site->categories[$content->id];
        }
        else {
            if (isset($content->category) && isset($this->site->categories[$content->category])) {
                return $this->site->categories[$content->category];
            }
        }

        return [];
    }
517212
protected function _defaultData($content)
    {
        $content = @unserialize($content);
        if (empty($content) || !is_a($content, \stdClass::class)) {
            $content = new \stdClass;
        }
        $content->selected = isset($content->selected) ? $content->selected : '';
        $content->price = isset($content->price) ? $content->price : '';
        return $content;
    }
832439
protected function getResponseJson($content)
    {
        $this->response = new Response\Json\Api();
        $this->response->setHttpCode(200);
        $this->response->setContent($content);

        return $this->response;
    }