Rerurn logo ASCII
@return string
965499
public static function getLogo()
    {
        // Verificar se foi definido a logo do app
        $file_logo_app = app_path('logo.txt');
        if (file_exists($file_logo_app))
            return file_get_contents($file_logo_app);

        // Logo do framework
        $file_logo = __DIR__ . '/Resources/logo.txt';
        if (file_exists($file_logo))
            return file_get_contents($file_logo);
        return '';
    }
786468
private function drawAscii()
    {
        $fail = [
            '(╯°□°）╯︵ ┻━┻',
            '¯\_(ツ)_/¯',
            '┻━┻︵ \(°□°)/ ︵ ┻━┻',
            '(ಠ_ಠ)',
            '(ノಠ益ಠ)ノ彡',
            '(✖﹏✖)'
        ];

        $pass = [
            '☜(ﾟヮﾟ☜)',
            '♪ヽ( ⌒o⌒)人(⌒-⌒ )v ♪',
            '┗(^-^)┓',
            'ヽ(^。^)ノ',
            'ヽ(^▽^)v'
        ];

        if (count($this->failures)) {
            $key = array_rand($fail, 1);
            $this->console->writeLn($fail[$key]);
        } else {
            $key = array_rand($pass, 1);
            $this->console->writeLn($pass[$key]);
        }
    }
644661
public static function ascii()
    {
        if (!self::$ascii) {
            self::$ascii = new static();
            self::$ascii->lineVLChar = '|';
            self::$ascii->lineVCChar = '|';
            self::$ascii->lineVRChar = '|';
            self::$ascii->lineHTChar = '-';
            self::$ascii->lineHCChar = '-';
            self::$ascii->lineHBChar = '-';
            self::$ascii->cornerTLChar = '+';
            self::$ascii->cornerTRChar = '+';
            self::$ascii->cornerBLChar = '+';
            self::$ascii->cornerBRChar = '+';
            self::$ascii->crossingCChar = '+';
            self::$ascii->crossingLChar = '+';
            self::$ascii->crossingRChar = '+';
            self::$ascii->crossingTChar = '+';
            self::$ascii->crossingBChar = '+';
        }

        return clone self::$ascii;
    }
707320
protected function getCorpusIcon()
  {
    if($this->currObj instanceof Channel && $this->currObj->isSpacer()) return;

    return $this->getImage($this->currObj->getIcon() . ".png");
  }
1326367
public function toHexString()
    {
        return '#' .
            $this->decToHex($this->r) .
            $this->decToHex($this->g) .
            $this->decToHex($this->b);
    }
140308
public function normalize(): string {
        if (!$this->uri) {
            return '';
        }

        $path = $this->path ?: '/';
        $path = $this->removeDotSegments($path);
        $path = $this->decodeUnreservedCharacters($path);
        $path = $this->decodeReservedSubDelimiters($path);

        return $this->reconstitute(
            $this->scheme,
            $this->getAuthority(),
            $path,
            $this->query,
            $this->fragment
        );
    }
1162452
private function hex($ascii)
    {
        $str = dechex(ord($ascii));
        if (!isset($str[1])) {
            $str = '0' . $str; //补位
        }
        return $str;
    }
280883
public static function uuid(): string
    {
        $chars = md5(uniqid(mt_rand(0, mt_getrandmax()), true));
        $uuid = substr($chars, 0, 8) . '-';
        $uuid .= substr($chars, 8, 4) . '-';
        $uuid .= substr($chars, 12, 4) . '-';
        $uuid .= substr($chars, 16, 4) . '-';
        $uuid .= substr($chars, 20, 12);
        return $uuid;
    }
37529
protected function getNewPrefix()
    {
        // Removing old sprites
        $find = new Finder();
        $fs = new Filesystem();
        $fs->remove(
            $find->in($this->imgDir)->directories(),
            $this->stylePath
        );

        // New prefix
        $prefix = substr(sha1(microtime(true) . 'sprites'), 1, 10);
        $fs->mkdir($this->imgDir . '/' . $prefix);

        return $prefix;
    }
462571
public function reverse($encoding = null)
    {
        $reversed = '';

        if (!$this->hasMbstring()) {
            $len = \strlen($this->string);
            for ($i = $len - 1; $i >= 0; --$i) {
                $reversed .= \substr($this->string, $i, 1);
            }
        } else {
            $encoding = $this->encoding($encoding);

            $len = \mb_strlen($this->string, $encoding);
            for ($i = $len - 1; $i >= 0; --$i) {
                $reversed .= \mb_substr($this->string, $i, 1, $encoding);
            }
        }

        $this->string = $reversed;
        return $this;
    }
563570
private function getCharacter()
    {
        $character = [];
        $character_index = 0;
        $char_table = $this->_parser->find('h2', 0);
        if ($char_table->next_sibling()->tag == 'table') {
            $char_table = $char_table->next_sibling();
            while (true) {
                $char_name_area = $char_table->find('td', 1);

                $character[$character_index]['image'] = $this->getCharacterImage($char_table);
                $character[$character_index]['id'] = $this->getCharacterId($char_name_area);
                $character[$character_index]['name'] = $this->getCharacterName($char_name_area);
                $character[$character_index]['role'] = $this->getCharacterRole($char_name_area);

                // va name + role
                $char_va_area = $char_table->find('td', 2);
                if ($char_va_area) {
                    $character[$character_index]['va'] = $this->getVa($char_va_area);
                }

                $char_table = $char_table->next_sibling();
                if ($char_table->tag == 'br' || $char_table->tag == 'a' || $char_table->tag == 'h2' || $char_table->tag == 'div') {
                    break;
                }
                $character_index++;
            }
        }

        return $character;
    }
167657
public function getLogoRef()
    {
        /** @var $organization \Organizations\Entity\Organization */
        $organization = $this->organization;
        if (is_object($organization) && $organization->getImage()) {
            $organizationImage = $organization->getImage();
            return "/file/Organizations.OrganizationImage/" . $organizationImage->getId();
        }
        return $this->logoRef;
    }
106667
protected static function getAsciiReplacements()
    {
        if (!empty(self::$asciiReplaces)) {
            return self::$asciiReplaces;
        }

        self::$asciiReplaces = (array) require __DIR__ . '/config/ascii-replacers.php';

        if (function_exists('apply_filters')) {
            self::$asciiReplaces = apply_filters(
                'ascii_character_replacements_filter',
                self::$asciiReplaces
            );
        }

        return self::$asciiReplaces;
    }
261224
public static function getSupportedEncodings()
    {
        if (static::$encodings === null) {
            static::$encodings = array_map('strtoupper', mb_list_encodings());

            // FIXME: Converting € (UTF-8) to ISO-8859-16 gives a wrong result
            $indexIso885916 = array_search('ISO-8859-16', static::$encodings, true);
            if ($indexIso885916 !== false) {
                unset(static::$encodings[$indexIso885916]);
            }
        }

        return static::$encodings;
    }
1037452
private static function unicodeChar($dec)
    {
        if ($dec < 0x80) {
            return chr($dec);
        }

        if ($dec < 0x0800) {
            return chr(0xC0 + ($dec >> 6))
                .chr(0x80 + ($dec & 0x3f));
        }

        if ($dec < 0x010000) {
            return chr(0xE0 + ($dec >> 12))
                    .chr(0x80 + (($dec >> 6) & 0x3f))
                    .chr(0x80 + ($dec & 0x3f));
        }

        if ($dec < 0x200000) {
            return chr(0xF0 + ($dec >> 18))
                    .chr(0x80 + (($dec >> 12) & 0x3f))
                    .chr(0x80 + (($dec >> 6) & 0x3f))
                    .chr(0x80 + ($dec & 0x3f));
        }
    }
774836
def logo_as_data_uri(self):
        """"""
        _, ext = os.path.splitext(self.logo.file.name)
        with open(self.logo.file.name, 'rb') as f:
            data = base64.b64encode(f.read())

        return 'data:image/{};base64,{}'.format(
            ext[1:],  # Remove the leading dot.
            data.decode()
        )
360126
public function generateSigninInput()
    {
        $base64payload = $this->encoder->encode(json_encode($this->getPayload(), JSON_UNESCAPED_SLASHES));
        $base64header = $this->encoder->encode(json_encode($this->getHeader(), JSON_UNESCAPED_SLASHES));

        return sprintf('%s.%s', $base64header, $base64payload);
    }