Generates an RGB color based on $id int or hex string

@param int|string $id

@return array
163265
public static function getRGBColor($id): array
    {
        if (strpos($id, '#') === 0) {
            $hash = substr($id, 1, 6);
        } else {
            $hash = md5($id); // modify 'color' to get a different palette
        }

        return [
            hexdec(substr($hash, 0, 2)), // r
            hexdec(substr($hash, 2, 2)), // g
            hexdec(substr($hash, 4, 2)), // b
        ];
    }
881371
public static function explodeColor($hexColor, int $dr = null, int $dg = null, int $db = null): array
    {
        $colors = [];
        preg_match_all('/^#?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/', trim($hexColor), $colors);
        if (isset($colors[1][0]) && isset($colors[2][0]) && isset($colors[3][0])) {
            return [hexdec($colors[1][0]), hexdec($colors[2][0]), hexdec($colors[3][0])];
        }
        return [$dr, $dg, $db];
    }
669921
protected function getGroupName(/*# string */ $id)/*# : string */
    {
        return explode(
            $this->config->getDelimiter(),
            ltrim($id, $this->config->getDelimiter())
        )[0];
    }
1333159
public function getRecipeById($id)
    {
        $result = [
            'className' => (isset($this->classNameById[$id])) ?
                $this->classNameById[$id] :
                null,
            'arguments' => (isset($this->argumentsById[$id])) ?
                $this->argumentsById[$id] :
                null,
            'constructor' => (isset($this->constructorById[$id])) ?
                $this->constructorById[$id] :
                null,
            'dependencies' => (isset($this->dependenciesById[$id])) ?
                $this->dependenciesById[$id] :
                null,
        ];

        return $result;
    }
1162258
public static function urlizeId($id)
    {
        if (is_array($id)) {
            $id = rawurlencode('('.self::flexiUrl($id).')');
        } else if (preg_match('/^ext:/', $id)) {
            $id = self::urlEncode($id);
        } else if (preg_match('/^code:/', $id)) {
            $id = self::code(self::urlEncode(self::uncode($id)));
        }
        return $id;
    }
69145
private static function getRenderer($id)
    {
        if (!isset(self::$renderers[$id])) {
            throw new \InvalidArgumentException("no such renderer: ".$id);
        }
        return self::$renderers[$id];
    }
338360
private function getImage($id)
    {
        $image = $this->getImageRepository()->find($id);

        if (empty($image)) {
            throw $this->createNotFoundException(sprintf('Unable to find image by ID "%d".', $id));
        }

        return $image;
    }
266313
public function getTemplateId(string $id)
    {
        $url = self::GET_ID.$this->access_token;
        $data = ['template_id_short' => $id];
        $request = json_encode($data);
        $json = $this->curl->post($url, $request);

        return $json;
    }
75258
public function getFromGroupWithChartType($id)
    {
        $query = $this->createQueryBuilder('c')
            ->join('c.libs', 'lib')
            ->addSelect('lib')
            ->join('lib.type', 'type')
            ->addSelect('type')
            ->where('c.idGroup = :idGroup')
            ->setParameter('idGroup', $id);

        return $query->getQuery()->getResult();
    }
1146003
public function exportById($id): array
    {
        $tagGroup = Craft::$app->tags->getTagGroupById((int) $id);

        return $this->export($tagGroup);
    }
893641
public function generateTokenById($id)
    {
        if (!is_null($user = $this->provider->retrieveById($id))) {
            return $this->jwt->fromUser($user);
        }
    }
559691
protected function createId($id)
    {
        if (is_null($id)) {
            return md5(join('_', [
                $this->config['shortcode'],
                $this->mobile,
                time(),
            ]));
        }

        return $id;
    }
562993
public function buildIds(string $id): array
    {
        $ids = [];
        $range = $this->buildRange($id);

        $from = $range->getFrom();
        $to = $range->getTo();
        $step = $range->getStep();
        for ($currentIndex = $from; $currentIndex <= $to; $currentIndex += $step) {
            $ids[
                str_replace(
                    $this->token,
                    $currentIndex,
                    $range->getName()
                )
            ] = $currentIndex;
        }

        return $ids;
    }
491439
public function exportById($id): array
    {
        $categoryGroup = Craft::$app->categories->getGroupById((int) $id);

        return $this->export($categoryGroup);
    }
92202
public function result($id): array
    {
        $options = ['query' => ['id' => $id]];

        /** @var JsonStream $stream */
        $stream = $this->client
            ->get(UserApi::generateUrl('csv/result.json'), $options)
            ->getBody();

        return $stream->jsonSerialize();
    }
805320
public static function convertId($id)
    {
        if (strlen($id) === 17) {
            $converted = substr($id, 3) - 61197960265728;
        } else {
            $converted = '765' . ($id + 61197960265728);
        }
        return (string)$converted;
    }
643505
public function exportById($id): array
    {
        $volume = Craft::$app->volumes->getVolumeById((int) $id);

        return $this->export($volume);
    }