@param BinaryInterface $binary

@return BinaryInterface
347581
public function process(BinaryInterface $binary)
    {
        $binary->getContent();

        $response = $this->client->request('POST', 'https://api.tinify.com/shrink', [
            'auth' => ['api', $this->apiKey],
            'body' => $binary->getContent(),
        ]);

        $data = json_decode($response->getBody(), true);
        $url = $data['output']['url'];

        return new Binary(file_get_contents($url), $binary->getMimeType(), $binary->getFormat());
    }
577034
public function andBinaryBody($body)
    {
        $this->response->setBody(BinaryInfo::BINARY_BODY_PREFIX . base64_encode($body));

        return $this;
    }
516148
public function deserialize($bin)
    {
        $data = @unpack('Cversion/Cfield0/H32traceId/Cfield1/H16spanId/Cfield2/Coptions', $bin);
        if ($data === false) {
            trigger_error('Invalid binary format for SpanContext', E_USER_WARNING);
            return new SpanContext();
        }
        $enabled = !!($data['options'] & self::OPTION_ENABLED);
        $spanId = $data['spanId'] == "0000000000000000"
            ? null
            : $data['spanId'];
        return new SpanContext($data['traceId'], $spanId, $enabled, true);
    }
1248851
public function loadBinaryFileByUri($binaryFileUri)
    {
        try {
            $image = $this->publishedIOService->loadBinaryFileByUri($binaryFileUri);

            if ($image instanceof MissingBinaryFile) {
                throw new InvalidArgumentException('binaryFileUri', sprintf("Can't find file with url %s", $binaryFileUri));
            }

            return $image;
        } catch (InvalidArgumentException $prefixException) {
            // InvalidArgumentException means that the prefix didn't match, NotFound can pass through
            try {
                return $this->draftIOService->loadBinaryFileByUri($binaryFileUri);
            } catch (InvalidArgumentException $e) {
                throw $prefixException;
            }
        }
    }
984989
public function setBinary(string $bin): Command
    {
        if (!is_file($bin)) {
            throw new \InvalidArgumentException('Binary file not exists: '.$bin, ErrorCodes::FILE_NOT_FOUND);
        }
        if (!is_executable($bin)) {
            throw new \InvalidArgumentException('Binary file is not executable: '.$bin, ErrorCodes::FILE_NOT_EXECUTABLE);
        }
        $this->bin = $bin;
        return $this;
    }
259576
public static function convertBinaryStringToNumber(string $binaryString): int
    {
        return self::convertEndianness((ord($binaryString{1}) << 8) + (ord($binaryString{0}) & 255));
    }
1113219
public function fromBin(string $bin):ByteArray{
		$bin = \trim($bin);

		if(!$this->isAllowedBin($bin)){
			throw new TraitException('invalid binary string');
		}

		return $this->fromArray(\array_map('bindec', \str_split($bin, 8)));
	}
888396
private function _convertFromBin($binary, $base, $pad)
    {
        switch ($base) {
            case 2:
                return DataConverter::pad($binary, ($pad ? $this->binSize : 0));
            case 10:
                return DataConverter::binToDec($binary, ($pad ? $this->decSize : 0));
            case 16:
                return DataConverter::binToHex($binary, ($pad ? $this->hexSize : 0));
        }
    }
844800
protected function binaryReverse(int $binaryInput, int $bitlen): int
    {
        $cloneBits = $binaryInput;
        $binaryInput = 0;
        $count = 0;

        while ($count < $bitlen) {
            ++$count;
            $binaryInput <<= 1;
            $binaryInput |= ($cloneBits & 0x1);
            $cloneBits >>= 1;
        }

        return $binaryInput;
    }
641145
public function getBinary(): string
    {
        if (is_null($this->bin)) {
            $paths = array('/usr/bin/assimp', '/usr/local/bin/assimp', '~/bin/assimp');
            foreach ($paths as $path) {
                try {
                    $this->setBinary($path);
                } catch (\InvalidArgumentException $e) {}
            }

            if (!$this->bin) {
                throw new \RuntimeException('assimp-binary not found in '.explode(', ', $paths), ErrorCodes::FILE_NOT_FOUND);
            }

            if (!is_executable($this->bin)) {
                throw new \RuntimeException('Found a binary file, but it is not executable: '.$this->bin, ErrorCodes::FILE_NOT_EXECUTABLE);
            }
        }
        return $this->bin;
    }
564441
public function encrypt($value, $raw_binary = false)
    {
        return Crypto::encryptWithPassword($value, $this->secret, $raw_binary);
    }
445253
public static int fromBinary(boolean[] binary)
    {
        Check.notNull(binary);

        int number = 0;
        for (final boolean current : binary)
        {
            number = number << 1 | boolToInt(current);
        }
        return number;
    }
1358794
protected function decode($binary)
    {
        $hex = bin2hex($binary);
        $this->signature = chr(hexdec(substr($hex, 0, 2)));
        $this->userPrivilege = hexdec(substr($hex, 2, 2));
        $this->callbackPhoneNumber = substr($hex, 4, 48);
    }
1027458
function binary($path) {
        if (function_exists('exec')) {
            exec($path.' -v 2>&1',$out,$ret);
            if ($ret==0 && preg_match('/cli/',@$out[0],$out))
                $this->binary=$path;
        }
        return $this->binary;
    }
471443
public void setBinary(File binary) {
    options.get(BINARY).setValue(BINARY.sanitize(binary));
  }
786537
public function write($binaryMessage)
    {
        if (strlen($binaryMessage) > self::PAYLOAD_MAX_BYTES) {
            throw new \InvalidArgumentException(
                sprintf('The maximum size allowed for a notification payload is %s bytes; Apple Push Notification Service refuses any notification that exceeds this limit.', self::PAYLOAD_MAX_BYTES)
            );
        }

        return fwrite($this->getApnsResource(), $binaryMessage);
    }
398259
private function _toIp($binary)
    {
        $ip  = array();
        $tmp = explode(".", chunk_split($binary, 8, "."));
        for ($i = 0; $i < 4 ; $i++) {
            $ip[$i] = bindec($tmp[$i]);
        }

        return $ip;
    }