[applyMask description]

@param  string $text
@param  string $mask
@return string
977931
public static function applyMask($text, $mask)
    {
        $length = strlen($text);
        $buff = '';

        $special = array('/', '.', '-', '_', ' ');

        for ($i = 0, $j = 0; $i < $length; $i++, $j++) {
            if (!isset($text[$i]) || !isset($mask[$j])) {
                break;
            }

            if (in_array($mask[$j], $special)) {
                $buff .= $mask[$j];
                $j++;
            }

            $buff .= $text[$i];
        }

        return $buff;
    }
725669
private static function buildPattern($masks)
    {
        $pattern = array();
        $masks = is_array($masks) ? $masks : [$masks];
        foreach ($masks as $mask) {
            $mask = rtrim(strtr($mask, '\\', '/'), '/');
            $prefix = '';
            if ($mask === '') {
                continue;

            } elseif ($mask === '*') {
                return NULL;

            } elseif ($mask[0] === '/') { // absolute fixing
                $mask = ltrim($mask, '/');
                $prefix = '(?<=^/)';
            }
            $pattern[] = $prefix . strtr(preg_quote($mask, '#'),
                    array('\*\*' => '.*', '\*' => '[^/]*', '\?' => '[^/]', '\[\!' => '[^', '\[' => '[', '\]' => ']', '\-' => '-'));
        }

        return $pattern ? '#/(' . implode('|', $pattern) . ')\z#i' : NULL;
    }
785604
protected function doHardBreaks($text) {
		if ($this->single_linebreak == true) {
			$expression = '/ {2,}\n|\n{1}/';
		} else {
			$expression = '/ {2,}\n/';
		}

		return preg_replace_callback($expression,
			array(&$this, '_doHardBreaks_callback'), $text);
	}
686485
public function resolve($mask)
    {
        if (is_string($mask)) {
            if (!defined($name = sprintf(static::class . '::MASK_%s', strtoupper($mask)))) {
                throw new \InvalidArgumentException("Constant do not exists $name");
            }
            
            return constant($name);
        }
        
        if (!is_int($mask)) {
            throw new \InvalidArgumentException("Mask is invalid. Should be an integer");
        }
        
        return $mask;
    }
691482
public function writeMerged($mask = '%s')
    {
        $str='';
        foreach ($this->cleanStack($this->getMerged(), 'path') as $entry) {
            $tag_attrs = array(
                'type'=>'text/javascript',
                'src'=>$entry['path']
            );
            $str .= sprintf($mask, Html::writeHtmlTag('script', null, $tag_attrs));
        }
        return $str;
    }
1046790
protected function getEscapedPattern($text)
    {
        $rawPattern = preg_quote($text, '/');

        $escapedPattern = preg_quote(e($text), '/');

        return $rawPattern == $escapedPattern
            ? $rawPattern : "({$rawPattern}|{$escapedPattern})";
    }
1294797
public function apply($text)
    {
        $foreground = null;
        $background = null;

        if($this->foreground)
            $foreground = 'color: ' . $this->foreground . ';';

        if($this->background)
            $background = 'background: ' . $this->background . ';';

        $dom = '<span style="'.$foreground.$background.'">' . $text . '</span>';

        return $dom;
    }
1113368
public static function values($mask, array $values)
    {
        foreach ($values as $k => $v) {
            $mask = str_replace('{' . $k . '}', $v, $mask);
        }

        return $mask;
    }
145267
public function setMask(int $mask): ZipInterface {

        $mask = filter_var($mask, FILTER_VALIDATE_INT, [
            "options" => [
                "max_range" => 0777,
                "default" => 0777
            ],
            'flags' => FILTER_FLAG_ALLOW_OCTAL
        ]);
        $this->mask = $mask;

        return $this;

    }
604594
public void setMask(byte[] mask) {
    if (mask == null) {
      throw new IllegalArgumentException("Transmitter mask cannot be null.");
    }
    if (mask.length != TRANSMITTER_ID_SIZE) {
      throw new IllegalArgumentException(String.format(
          "Transmitter mask must be %d bytes long.",
          Integer.valueOf(TRANSMITTER_ID_SIZE)));
    }
    this.mask = mask;
  }
614860
public static String mask(final String mask, final String value)
    {
        return maskFormat(mask).format(value);
    }
251371
public function write($mask = '%s')
    {
        $str='';
        foreach ($this->cleanStack($this->get()) as $entry) {
            $str .= (strlen($str)>0 ? $this->separator : '').$entry;
        }
        $title_str = Html::writeHtmlTag('title', strip_tags($str));
        return sprintf($mask, $title_str);
    }
518189
public function purge($text)
    {
        if (!$matches = $this->getMatches($text)) {
            return $text;
        }

        return str_replace($matches, '', $text);
    }
772123
public void setMasks(String masks) {
        String[] subMasks = masks.split(separate);
        this.masks = new String[subMasks.length];
        for (int i = 0; i < subMasks.length; ++i)
            this.masks[i] = subMasks[i];
    }
857357
protected function fromInotifyMask($mask)
    {
        $mask &= ~IN_ISDIR;
        $event = 0;
        switch ($mask) {
            case (IN_MODIFY):
            case (IN_ATTRIB):
                $event =  FilesystemEvent::MODIFY;
                break;
            case (IN_CREATE):
                $event =  FilesystemEvent::CREATE;
                break;
            case (IN_DELETE):
            case (IN_IGNORED):
                $event =  FilesystemEvent::DELETE;
        }

        return $this->supportsEvent($event) ? $event : false;
    }
44547
protected function mask($payload)
    {
        $length = strlen($payload);
        $mask = $this->getMask();

        $unmasked = '';
        for ($i = 0; $i < $length; $i++) {
            $unmasked .= $payload[$i] ^ $mask[$i % 4];
        }

        return $unmasked;
    }
930783
protected static function removeTrailingNewline($text)
    {
        return substr($text, - 1) === "\n" ? substr($text, - 2, 1) === "\r" ? substr($text, 0, - 2) : substr($text, 0, - 1) : $text;
    }