Patterns function to replace their values

@access	public
@param   array   $data
@return  array
976732
public static function setTemplate($data)
    {
        /***********************************
         * Message subject replace
         ************************************/

        //if (isset($data['message']))    $data['subject']    = str_replace("#message#", $data['message'], $data['subject']);      // Message coded ID, to track (comunik)
        if (isset($data['contactKey'])) $data['subject']    = str_replace("#contactKey#",   $data['contactKey'],                    $data['subject']);  // Contact coded ID, to track (comunik)
        if (isset($data['company']))    $data['subject']    = str_replace("#company#",      $data['company'],                       $data['subject']);  // Company name (comunik)
        if (isset($data['name']))       $data['subject']    = str_replace("#name#",         $data['name'],                          $data['subject']);  // Contact name (comunik)
        if (isset($data['surname']))    $data['subject']    = str_replace("#surname#",      $data['surname'],                       $data['subject']);  // Contact surname (comunik)
        if (isset($data['birthDate']))  $data['subject']    = str_replace("#birthDate#",    $data['birthDate'],                     $data['subject']);  // BirthDate (comunik)
        if (isset($data['email']))      $data['subject']    = str_replace("#email#",        $data['email'],                         $data['subject']);  // Contact email (comunik)
        $data['subject']                                    = str_replace("#date#",         date(config('pulsar.datePattern')),     $data['subject']);  // Current date

        /***********************************
         * Message html format replace
         ************************************/
        if(isset($data['html']))
            $data = self::replaceWildcard($data, 'html');

        /***********************************
         * Message text format replace
         ************************************/
        if(isset($data['text']))
            $data = self::replaceWildcard($data, 'text');

        return $data;
    }
1199415
public function replace(array $data) {
        $addFields = implode('`,`', array_keys($data));
        return $this->command()
            ->insertOrReplace("`{$addFields}`", Str::repeat('?', $data),
                array_values($data));
    }
1235046
public function transform($data)
    {
        if ($data instanceof BlockInterface) {
            return array_merge(array(
                'id' => $data->getId(),
                'label' => $data->getLabel(),
                'style' => $data->getStyle(),
                'maxAge' => $data->getMaxAge(),
                'code' => $data->getCode(),
            ), $data->getAttributes());
        }

        return $data;
    }
683918
protected function removeRedundantParams(array $data): array
    {
        $data = array_filter($data, function ($item) {
            if ($item instanceof ArrayObject) {
                return $item->count() !== 0;
            }
            return !empty($item);
        });

        foreach ($data as $key => $value) {
            if (is_array($value) || $value instanceof ArrayObject) {
                $data[$key] = $this->removeRedundantParams($value);
            }
        }

        return $data;
    }
536448
protected function flatten(array $data): array
    {
        $result = [];
        foreach ($data as $key => $value) {
            $item = [
                'label' => $value['label'],
                'inactive' => $value['inactive']
            ];

            $result[$key] = $item;

            if (isset($value['children'])) {
                $result = array_merge($result, $this->flatten($value['children']));
            }
        }

        return $result;
    }
118048
protected function replaceVars ($data)
	{

		// Replace variables

		foreach ($this->vars as $key => $val)
		{
			$data	= str_replace ($this->startDelimiter . $key . $this->endDelimiter, $val, $data);
		}

		// Remove any remaining variables in the template

		$data	= preg_replace ('/' . $this->startDelimiter . '.*' . $this->endDelimiter . '/', '', $data);

		// Return replaced data string

		return $data;

	}
313110
protected function arrayDotKeysFlattern(array $data)
    {
        foreach ($data as $name => $values) {
            if ($this->isIterable($values)) {
                foreach ($values as $key => $key_value) {
                    $data["$name.$key"] = $values[$key];
                }
                unset($data[$name]);
            }
        }
        return $data;
    }
333480
public static function generate($pattern, array $data = [])
    {
        $route = static::replaceOptionalSegments($pattern, $data);
        $route = static::replaceWildCards($route, $data);

        return static::replaceAllSegments($route, $data);
    }
1030045
protected function transform($data)
    {

        $items = [
            'name'       => $data[ 'name' ],
            'static'     => $this->boolValue($data[ '@attributes.static' ]),
            'line'       => (int)$data[ '@attributes.line' ],
            'visibility' => $data[ '@attributes.visibility' ],
            'namespace'  => $data[ '@attributes.namespace' ],
            'package'    => $data[ '@attributes.package' ],

            'description'      => $this->createDescription($data[ 'docblock.description' ]),
            'long-description' => $this->createDescription($data[ 'docblock.long-description' ]),
        ];

        $items[ 'full_name' ]  = $data->get('full_name', $this->belongsTo[ 'full_name' ] . '::' . Str::removeLeft($data[ 'name' ], '$'));
        $items[ 'class_name' ] = head(explode('::', $items[ 'full_name' ]));
        $items[ 'inherited' ]  = $this->belongsTo[ 'full_name' ] !== $items[ 'class_name' ];
        $items[ 'tags' ]       = $this->structures('docblock.tag', Tag::class, $data);

        $types = $data->get('docblock.tag.type', 'mixed');
        if ( !is_array($types) ) {
            $types = [ $types ];
        }
        $items[ 'types' ] = $types;

        return $items;
    }
51359
public function xssClean(array $data)
    {
        foreach ($data as $k => $v) {
            $data[$k] = filter_var($v, FILTER_SANITIZE_STRING);
        }

        return $data;
    }
982843
public function formatToItems(string $data): array
    {
        return array_map(function (array $item) {
            $itemAsArray = [
                'uuid' => [
                    'id' => $item[0],
                    'type' => $item[1],
                ],
                'metadata' => $item[2],
                'indexed_metadata' => $item[3],
                'searchable_metadata' => $item[4],
                'exact_matching_metadata' => $item[5],
                'suggest' => $item[6],
            ];

            if (!empty($item[7])) {
                $itemAsArray['coordinate'] = $item[7];
            }

            return Item::createFromArray($itemAsArray);
        }, json_decode($data, true));
    }
497073
public function replace(string $text, Array $data): string {
    $replaceText = $text;
    if (!empty($text) && count($data)) {
      foreach ($data as $key => $value) {
        $replaceText = preg_replace("#(\{data\:{$key}\})#i", $value, $replaceText);
      }
    }
    return $replaceText;
  }
655991
public function doReplace($data)
    {
        $data = preg_replace_callback(
            '/#([^\s\r#]+)#/',
            function ($matches) {
                if (defined($matches[1])) {
                    return constant($matches[1]);
                }

                return $matches[0];
            },
            $data
        );

        if (isset($this->values)) {
            $values = $this->values;

            $data = preg_replace_callback(
                '/%([^\s\r%]+)%/',
                function ($matches) use ($values) {
                    if (isset($values[$matches[1]])) {
                        return $values[$matches[1]];
                    }

                    return $matches[0];
                },
                $data
            );
        }

        return $data;
    }
786215
public function strip_php_tags($data)
    {
        if (is_array($data)) {
            foreach ($data as $key=>$value) {
                $data[$key] = $this->strip_php_tags($value);
            }
            return $data;
        }
        return addslashes(htmlspecialchars(strip_tags($data)));
    }
1066516
private function replace($text, $data)
    {
        // Replace Data Tokens:
        
        foreach ($data as $key => $value) {
            
            if (is_scalar($value)) {
                $text = str_replace("{{$key}}", $value, $text);
            }
            
        }
        
        // Replace Config Tokens:
        
        foreach ($this->config as $key => $value) {
            
            if (is_scalar($value)) {
                $text = str_replace("{{$key}}", $value, $text);
            }
            
        }
        
        // Answer Text:
        
        return $text;
    }
516589
public static function arrayResolve(array $data)
    {

        $array = [];

        foreach ($data as $provider => $bool) {

            if ($bool === true) {

                $array['required'][] = $provider;

            }
            else {

                $array['hidden'][] = $provider;

            }
        }

        return $array;
    }
392169
protected function cleanData(array $data): array
    {
        $options = $this->getOptions();

        $disallowedDataKeys = array(
            $options->getIdColumnName(),
            $options->getLeftColumnName(),
            $options->getRightColumnName(),
            $options->getLevelColumnName(),
            $options->getParentIdColumnName(),
        );

        if (null !== $options->getScopeColumnName()) {
            $disallowedDataKeys[] = $options->getScopeColumnName();
        }

        return array_diff_key($data, array_flip($disallowedDataKeys));
    }