Compiles lookup methods for marked bindings.

@param array<string, array<string, Binding>> $marked
@return string
4051
protected function compileMarkerLookup(array $marked)
	{
		$code = '';
		
		foreach($marked as $markerType => $markedBindings)
		{
			$code .= "\tpublic function markedBindings_" . str_replace('\\', '_', $markerType) . "() {\n";
			$code .= "\t\tstatic \$bindings;\n";
			$code .= "\t\tif(\$bindings === NULL) {\n";
			$code .= "\t\t\t\$bindings = [\n";
				
			$index = 0;
				
			foreach($markedBindings as $binding)
			{
				foreach($binding->getMarkers() as $marker)
				{
					if(!$marker instanceof $markerType)
					{
						continue;
					}
						
					if($index++ != 0)
					{
						$code .= ",\n";
					}
						
					$vars = get_object_vars($marker);
						
					$code .= "\t\t\t\t[\$this->reviveMarker(";
					$code .= var_export(get_class($marker), true);
						
					if(!empty($vars))
					{
						$code .= ', ' . var_export($vars, true);
					}
						
					$prop = str_replace('\\', '_', $binding->getTypeName());

					$code .= "), (\$this->bound[" . var_export($binding->getTypeName(), true);
					$code .= "] !== true) ? \$this->bound[" . var_export($binding->getTypeName(), true);
					$code .= "] : (\$this->bound[" . var_export($binding->getTypeName(), true);
					$code .= "] = \$this->binding_$prop())]";
				}
			}
				
			$code .= "\n\t\t\t];\n\t\t}\n";
			$code .= "\t\treturn \$bindings;\n";
			$code .= "\t}\n\n";
		}
		
		return $code;
	}
309206
public function markMailFields($mailFields)
    {
        $markedMailFields = \MUtil_Ra::braceKeys($mailFields, $this->mailFieldMarkers['start'], $this->mailFieldMarkers['end']);
        return $markedMailFields;
    }
582747
private function _mangleTags($tags)
    {
        foreach ($tags as $i => $tag) {
            $tags[$i] = $this->_mangleTag($tag);
        }
        return $tags;
    }
61234
public function getIdsMatchingTags($tags = array())
    {
        if (!$this->_extendedBackend) {
            Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
        }
        if (!($this->_backendCapabilities['tags'])) {
            Zend_Cache::throwException(self::BACKEND_NOT_SUPPORTS_TAG);
        }

        $ids = $this->_backend->getIdsMatchingTags($tags);

        // we need to remove cache_id_prefix from ids (see #ZF-6178, #ZF-7600)
        if (isset($this->_options['cache_id_prefix']) && $this->_options['cache_id_prefix'] !== '') {
            $prefix    = & $this->_options['cache_id_prefix'];
            $prefixLen = strlen($prefix);
            foreach ($ids as &$id) {
                if (strpos($id, $prefix) === 0) {
                    $id = substr($id, $prefixLen);
                }
            }
        }

        return $ids;
    }
475303
protected function getFormattedTags(array $tags)
    {
        $add =array();

        foreach ($tags as $key => $value) {
            if (is_bool($value)) {
                $value = $value ? "true" : "false";
            }
            $add[] = "#$key:$value";
        }

        return !empty($add) ? '|'.implode(',', $add) : null;
    }
67160
protected function tagKeys(array $keys)
    {
        $prefix = $this->taggedItemKey('');

        return array_map(function ($key) use ($prefix) {
            return $prefix.$key;
        }, $keys);
    }
811034
public function untag($tags = null)
    {
        if (empty($tags)) {
            return $this->_updateTags([], 'replace');
        }

        $table = TableRegistry::getTableLocator()->get($this->source());
        $behavior = $table->behaviors()->Tag;
        $assoc = $table->getAssociation($behavior->getConfig('tagsAlias'));
        $property = $assoc->getProperty();
        $id = $this->get($table->getPrimaryKey());
        $untags = $behavior->normalizeTags($tags);

        $tags = $this->get($property);
        if (!$tags) {
            $contain = [$behavior->getConfig('tagsAlias')];
            $tags = $table->get($id, compact('contain'))->get($property);
        }

        $tagsTable = $table->{$behavior->getConfig('tagsAlias')};
        $pk = $tagsTable->getPrimaryKey();
        $df = $tagsTable->getDisplayField();

        foreach ($tags as $k => $tag) {
            $tags[$k] = [
                $pk => $tag->{$pk},
                $df => $tag->{$df},
            ];
        }

        foreach ($untags as $untag) {
            foreach ($tags as $k => $tag) {
                if ((empty($untag[$pk]) || $tag[$pk] === $untag[$pk]) &&
                    (empty($untag[$df]) || $tag[$df] === $untag[$df])
                ) {
                    unset($tags[$k]);
                }
            }
        }

        return $this->_updateTags(
            array_map(
                function ($i) {
                    return implode(':', $i);
                },
                $tags
            ),
            'replace'
        );
    }
651827
protected function indexAnnotationsByType(array $annotations)
    {
        $indexed = array();

        // if we are receiving annotations indexed by number, transform it to by class name
        if ($annotations && is_numeric(key($annotations))) {
            foreach ($annotations as $annotation) {
                $annotationType = get_class($annotation);

                if (isset($indexed[$annotationType]) && !is_array($indexed[$annotationType])) {
                    $indexed[$annotationType] = array($indexed[$annotationType], $annotation);
                } elseif (isset($indexed[$annotationType])) {
                    $indexed[$annotationType][] = $annotation;
                } else {
                    $indexed[$annotationType] = $annotation;
                }
            }
        }

        return $indexed;
    }
644998
public function getMarkup($indentation = '')
	{
		$line = $this->getOption(self::OPTION_LINE_BREAK);
		$tab = $this->getOption(self::OPTION_INDENTATION);

		$xmlString = '';
		if (empty($this->name)) {
			$last = count($this->children) - 1;
			foreach ($this->children as $i => $child) {
				$xmlString .= $child->getMarkup($indentation);
				if ($i < $last) {
					$xmlString .= $line;
				}
			}
			return $xmlString;
		}

		// no linebreak -> no tabspace
		$indent1 = $indentation;
		if ($line == '') {
			$indent2 = '';
			$indent3 = '';
		}
		else {
			$indent2 = $indentation . $tab;
			$indent3 = $indentation;
		}

		if ($this->isRoot() && !$this->sub) {
			if (static::XML_DECLARATION) {
				$xmlString .= $this->xmlDecl();
			}
			if (count($this->processingInstr) > 0) {
				foreach ($this->processingInstr as $instr) {
					$xmlString .= $instr->getMarkup() . $line;
				}
			}
			if (static::DOCTYPE) {
				$xmlString .= static::DOCTYPE . $line;
			}
		}
		if (count($this->children) > 0) {
			$xmlString .= $indent1 . $this->openingTag() . $line;
			if ($this->cdata) {
				$xmlString .= $indent3 . self::CDATA_START . $line;
			}
			if ($this->content != null) {
				$xmlString .= $indent2 . $this->prepareContent(
						$this->content, $indent2, $line) . $line;
			}
			foreach ($this->children as $child) {
				if (is_string($child)) {
					$xmlString .= $indent2 . $this->prepareContent(
							$child, $indent2, $line) . $line;
				}
				else {
					$xmlString .= $child->getMarkup($indent2) . $line;
				}
			}
			if ($this->cdata) {
				$xmlString .= $indent3 . self::CDATA_STOP . $line;
			}
			$xmlString .= $indent3 . $this->closingTag();
		}
		else {
			$xmlString .= $indent1 . $this->element($indent1, $line, $this->cdata);
		}
		return $xmlString;
	}
733938
public function isMarked($marker)
	{
		if(empty($this->markers))
		{
			return false;
		}
		
		if($marker instanceof \ReflectionClass)
		{
			foreach($this->markers as $check)
			{
				if($marker->isInstance($check))
				{
					return true;
				}
			}
		}
		elseif($marker instanceof Marker)
		{
			foreach($this->markers as $check)
			{
				if($marker->isInstance($check))
				{
					return true;
				}
			}
		}
		else
		{
			foreach($this->markers as $check)
			{
				if($check instanceof $marker)
				{
					return true;
				}
			}
		}
		
		return false;
	}
511562
protected function findFlag()
	{
		$annotation = 'secured';

		$signal = $this->signal;
		$signal = is_array($signal) ? reset($signal) : $signal;

		$actionMethod = $this->formatActionMethod($this->action);
		$signalMethod = $this->formatSignalMethod($signal);
		$renderMethod = $this->formatRenderMethod($this->view);

		if ($this->hasAnnotation($annotation))
		{
			return $this->getAnnotation($this->getReflection(), $annotation);
		}
		elseif ($this->hasMethodAnnotation($actionMethod, $annotation))
		{
			$reflection = Method::from($this, $actionMethod);
			return $this->getAnnotation($reflection, $annotation);
		}
		elseif ($this->isSignalReceiver($this) && $this->hasMethodAnnotation($signalMethod, $annotation))
		{
			$reflection = Method::from($this, $signalMethod);
			return $this->getAnnotation($reflection, $annotation);
		}
		elseif ($this->hasMethodAnnotation($renderMethod, $annotation))
		{
			$reflection = Method::from($this, $renderMethod);
			return $this->getAnnotation($reflection, $annotation);
		}

		return NULL;
	}
31702
public function tags(Tags $tags = null)
    {
        if (is_null($tags)) {
            return $this->tags;
        }

        $this->tags = $tags;

        return $this;
    }
847887
public static function dot_array($arrayDotted)
    {
        $array = array();
        foreach ($arrayDotted as $key => $value) {
            self::array_set($array, $key, $value);
        }
        return $array;
    }
1301020
protected function compileStatement($match)
    {
        if (Str::contains($match[1], '@')) {
            $match[0] = isset($match[3]) ? $match[1].$match[3] : $match[1];
        } elseif (isset($this->customDirectives[$match[1]])) {
            $match[0] = $this->callCustomDirective($match[1], Arr::get($match, 3));
        } elseif (method_exists($this, $method = 'compile'.ucfirst($match[1]))) {
            $match[0] = $this->$method(Arr::get($match, 3));
        }

        return isset($match[3]) ? $match[0] : $match[0].$match[2];
    }
1089429
public function getCachePrefix()
    {
        if ($this->cachePrefix) {
            return $this->cachePrefix;
        }

        $class = $this->getClassName();

        if (!in_array(TaggedEntityInterface::class, class_implements($class))) {
            throw new \RuntimeException(sprintf(
                'The entity %s does not implements %s, query should not be cached.',
                $class, TaggedEntityInterface::class
            ));
        }

        return $this->cachePrefix = call_user_func([$this->getClassName(), 'getEntityTagPrefix']);
    }
1022300
protected static function getClassMethodsByPrefix($prefix = null)
    {
        //
        $attribute = 'MethodsByPrefix:'.$prefix;

        if (!static::hasClassAttribute($attribute)) {
            $class = static::getClass();
            $allMethods = get_class_methods($class);
            $methods = [];

            if (count($allMethods) > 0) {
                foreach ($allMethods as $method) {
                    if (preg_match('/^'.$prefix.'/i', $method)) {
                        $methods[] = $method;
                    }
                }
            }
            asort($methods);

            static::setClassAttribute($attribute, $methods);
        }

        //
        return static::getClassAttribute($attribute);
    }
841552
public function getFieldAnnotationsContainingMatchingTag($tag) {
        $matchingAnnotations = array();
        foreach ($this->getFieldAnnotations() as $field => $fieldAnnotations) {
            if (isset($fieldAnnotations[$tag])) {
                $matchingAnnotations[$field] = $fieldAnnotations;
            }
        }

        return $matchingAnnotations;

    }