Skaluje obrazek o podany procent zachowując proporcje
@param mixed $input wejście
@param int $percent procent o jaki ma być zmieniony rozmiar obrazka
@return resource obrazek
766017
public static function scaleProportional($input, $percent)
    {
        //brak zasobu
        $resource = self::inputToResource($input);
        //badanie rozmiarów obrazu
        $width = imagesx($resource);
        $height = imagesy($resource);
        //obliczanie rozmiarów po skalowaniu
        $sx = round($width * $percent / 100);
        $sy = round($height * $percent / 100);
        //tworzenie tymczasowego zasobu
        $tmp = imagecreatetruecolor($sx, $sy);
        //zapis przeźroczystości
        self::_saveAlpha($tmp);
        //skalowanie
        imagecopyresampled($tmp, $resource, 0, 0, 0, 0, $sx, $sy, $width, $height);
        return $tmp;
    }
768040
public function forward(Matrix $input) : Matrix
    {
        $mask = Matrix::rand(...$input->shape())
            ->greater($this->ratio);

        $saturation = $mask->map([$this, 'saturate']);

        $this->mask = $mask;

        return $input->multiply($mask)
            ->add($saturation)
            ->multiply($this->alpha)
            ->add($this->beta);
    }
1274859
function percent_px(el, prop, percent) {
          var parent_width = Embedo.utils.compute(el.parentNode, prop, true);
          percent = parseFloat(percent);
          return parent_width * (percent / 100);
        }
192859
public static function create(Process $process, $input)
    {
        return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
    }
678063
private function convert($input) : Rates
    {
        $rates = new Rates();
        $rates->timestamp = time();
        $rates->date = $this->date;
        $rates->base = 'EUR';
        $rates->rates = [];
        $rates->url = $this->url;

        $data = json_decode($input, true);

        if (!empty($data)) {
            if (!empty($data['rates'])) {
                $rates->extra['fixer_date'] = $data['date'] ?? null;
                foreach ($data['rates'] as $key => $row) {
                    $rates->rates[$key] = $row;
                }
                //add 1:1 conversion rate from base for testing
                $rates->rates[$data['base']] = 1;
            }
        }
        else {
            $rates->error = "No data in response from Fixer.io";
        }

        return $rates;
    }
935461
private static function parseRgbComponent($input, &$result)
    {
        if (preg_match('/^\\s*(\\d*(?:\\.\\d*)?)(%?)\\s*$/', $input, $matches)) {
            $result = floatval($matches[1]);
            
            if ($matches[2] === '%') {
                $result = 255 * $result / 100;
            }
            
            $result = (int)$result;
            
            if ($result < 0) $result = 0;
            if ($result > 255) $result = 255;
            
            return true;
        }
        return false;
    }
1040556
public function convert( $input ) {

        $result = new SearchResult(
            array(
                'time'       => 0,
                'maxScore'   => 0,
                'totalCount' => $input['SearchCount'],
            )
        );

        $contentService = $this->repository->getContentService();

        foreach ( $input['SearchResult'] as $doc )
        {
            $contentObject = $contentService->loadContent( $doc->ContentObjectID );
            $searchHit = new SearchAndFilterHit(
                array(
                    'score'         => 0,
                    'valueObject'   => $contentObject,
                    'objectStates'  => $this->loadContentObjectStates( $contentObject->contentInfo )
                )
            );
            $result->searchHits[] = $searchHit;
        }
        return $result;
    }
1057498
protected function convertPositiveTo($input)
    {
        $extraLen = strlen($input) - 5;

        if ($extraLen < 0) {
            return str_pad($input, 4, '0', STR_PAD_LEFT);
        }

        if ($extraLen < 26) {
            return chr(static::ORD_START + $extraLen) . $input;
        }

        $extraLen -= 25;

        $prefix = '';
        $carets = '';

        do {
            $carets .= '^';
            $extraLen--;

            $prefix = chr(static::ORD_START + $extraLen % 26) . $prefix;
            $extraLen = intval($extraLen / 26);
        } while ($extraLen);

        return "${carets}${prefix}${input}";
    }
71364
public static function date($input) {
        $input = Time::toUnix($input);

        if (!$input) {
            return false;
        }

        list($m, $d, $y) = explode('/', date('m/d/Y', $input));

        return checkdate($m, $d, $y);
    }
233136
public function decode($input)
    {
        $parts = explode('.', $input);

        foreach ($parts as &$part) {
            if (strpos($part, static::PREFIX) === 0) {
                $part = $this->_decodePart(
                    substr($part, strlen(static::PREFIX))
                );
            }
        }

        return implode('.', $parts);
    }
1261953
public static function inputToResource($input)
    {
        //jeśli resource zwrot
        if (gettype($input) == 'resource') {
            return $input;
        }
        //jeśli krótki content zakłada że to ścieżka pliku
        return imagecreatefromstring((strlen($input) < self::BINARY_MIN_LENGTH) ? file_get_contents($input) : $input);
    }
1057386
public function get()
    {
        //iteracja po danych
        foreach ($this->_data as $key => $item) {
            if ($this->_elapsed == 0) {
                $this->_data[$key]['percent'] = 0;
                continue;
            }
            $this->_data[$key]['percent'] = 100 * $item['elapsed'] / $this->_elapsed;
        }
        return $this->_data;
    }
833555
protected function createLanguage($input)
    {
        if (!$this->option('without-languages')) {
            $this->call(
                'create:language',
                [
                    'model-name' => $input->modelName,
                    '--language-filename' => $input->languageFileName,
                    '--resource-file' => $input->resourceFile,
                    '--template-name' => $input->template,
                    '--force' => $input->force,
                ]
            );
        }

        return $this;
    }
997147
public function prepare($input)
    {
        foreach ($input as $key => $record) {
            $this->setFieldOriginalValue($key);
            $input[$key] = $this->prepareValue($key, $record);
        }

        return $input;
    }
225749
private function convert($input) : Rates
    {
        $rates = new Rates();
        $rates->timestamp = time();
        $rates->date = $this->date;
        $rates->base = 'EUR';
        $rates->rates = [];
        $rates->url = $this->url;

        if (!empty($input)) {
            $data = json_decode($input, true);
            if (!empty($data)) {
                $series = end($data['dataSets']) ?? null;
                $structure = $data['structure']['dimensions']['series'] ?? null;

                $rates->extra['european_central_bank_valid_from'] = $series['validFrom'] ?? null;

                $newrates = [];

                if (!empty($structure)) {
                    foreach ($structure as $struc) {
                        if ($struc['id'] === 'CURRENCY') {
                            if (!empty($struc['values'])) {
                                foreach ($struc['values'] as $label) {
                                    $labels[] = $label['id'];
                                }
                            }
                        }
                    }
                }

                if (!empty($series['series'])) {
                    foreach ($series['series'] as $row) {
                        $avg = 0;
                        $counter = 0;
                        foreach ($row as $subrow) {
                            if (!empty($subrow)) {
                                foreach ($subrow as $value) {
                                    $avg += $value[0];
                                    $counter++;
                                }
                            }
                        }
                        $newrates[] = $avg / $counter;
                    }
                }

                if (!empty($labels) and !empty($newrates)) {
                    foreach ($labels as $i => $label) {
                        $rates->rates[$label] = $newrates[$i];
                    }
                    //add 1:1 conversion rate from base for testing
                    $rates->rates['EUR'] = 1;
                }
            }
        }
        else {
            $rates->error = "No data in response from the European Central Bank.";
        }

        return $rates;
    }
464340
private function tokenize($input, $limit = -1)
    {
        $chunks = preg_split('!\s+!', $input, $limit);
        if ($limit !== -1 && count($chunks) != $limit) {
            $chunks += array_fill(count($chunks), $limit, '');
        }
        return $chunks;
    }
475626
public function genSalt($input = null)
    {
        if (!$input) {
            $input = $this->_getRandomBytes(6);
        }

        // Hash identifier
        $identifier = $this->_phpBBCompat ? 'H' : 'P';

        // Cost factor
        $costFactor = $this->_itoa64[min($this->_iterationCountLog2 + 5, 30)];

        // Salt string
        $salt = $this->_encode64($input, 6);

        return '$' . $identifier . '$' . $costFactor . $salt;
    }