Split the zip archive.
@param string $i The zip archive.
@param integer $s The max size for the parts.
@return integer Return the number of parts created.
339454
protected static function split($i, $s){
        $fs = filesize($i);
        //$bn = basename($i);
        //$dn = dirname($i).DIRECTORY_SEPARATOR;
        $p = 1;
        
        for($c = 0; $c < $fs; $c = $c + $s){
            $data = file_get_contents($i, FILE_BINARY, null, $c, $s);
            //$fn = "$dn$bn.$p";
            $fn = "$i.$p";
            file_put_contents($fn, $data);
            $p++;
            unset($data);
        }
        unlink($i);
        return $p - 1;
    }
689690
public static function divide_guid_bin($guids)
    {
        if (!is_string($guids) || strlen($guids) == 0 || strlen($guids) % 16 > 0) {
            return [];
        }
        return str_split($guids, 16);
    }
421044
private function getSplit($key, $parts)
    {
        $keys = array();
        for ($i = 0; $i < $parts; $i++) {
            $keys[] = $key.$i;
        }

        $values = $this->memcached->getMulti($keys);

        if (false === $values) {
            $msg = sprintf(
                'Unable to retrieve split key "%s": %s.',
                $key,
                $this->memcached->getResultMessage()
            );

            $this->getLogger()->log(LogLevel::NOTICE, $msg);
            throw new \RuntimeException($msg);
        }

        $value = implode('', $values);

        return $value;
    }
1215045
public function split($regex = '//u', $limit = -1){
		
		if(!\is_string($regex)){
			throw new \InvalidArgumentException('$regex is not a string');
		}
		
		if(!\is_numeric($limit)){
			throw new \InvalidArgumentException('$limit is not a number');
		}
		
		return \preg_split($regex, $this->_Value, $limit, \PREG_SPLIT_NO_EMPTY);
		
	}
1009442
public static Integer[] splitToInt(final String ids) {
    if (isEmpty(ids)) return new Integer[0];
    else return transformToInt(split(ids, ','));
  }
386956
private function computePartSize($partSize)
    {
        $partSize = (integer)$partSize;
        if ($partSize <= self::OSS_MIN_PART_SIZE) {
            $partSize = self::OSS_MIN_PART_SIZE;
        } elseif ($partSize > self::OSS_MAX_PART_SIZE) {
            $partSize = self::OSS_MAX_PART_SIZE;
        }
        return $partSize;
    }
398959
function SplitIndex(s) {
        var spl = s.split(spDelim);
        this.id = spl[0];
        this.value = spl[1];
    }
272090
public function split(int $buffer, int $max, int $offsetStart = 0): iterable
    {
        for ($offset = $offsetStart; $offset < $max; $offset += $buffer) {
            yield $offset => $this->offset($offset)->limit($buffer);
        }
    }
1041581
private function setSplit($key, $value)
    {
        $values = str_split($value, self::VALUE_SPLIT_SIZE);

        $to_set       = array();
        $to_set[$key] = self::VALUE_SPLIT.count($values);

        foreach ($values as $part_nr => $v) {
            $to_set[$key.$part_nr] = $v;
        }

        if (false === $this->memcached->setMulti($to_set)) {
            $msg = sprintf(
                'Unable to store split values for key "%s": %s.',
                $key,
                $this->memcached->getResultMessage()
            );

            $this->getLogger()->log(LogLevel::NOTICE, $msg);
            throw new \RuntimeException($msg);
        }

        return $value;
    }
1019799
protected function extractSizeInfo($i)
	{
		// Extract size info from SOF marker
		list(, $unpacked) = unpack("H*", substr($this->data, $i - 1 + self::LONG_SIZE, self::LONG_SIZE));

		// Get width and height from unpacked size info
		$size = array(
			'width'		=> hexdec(substr($unpacked, 4, 4)),
			'height'	=> hexdec(substr($unpacked, 0, 4)),
		);

		return $size;
	}
109507
public function splitInner(array $arguments = array()) {
		if (is_null($this->_InnerSplitter)) {
			return new ArrayIterator(array($arguments));
		}
		return $this->_InnerSplitter->split($arguments);
	}
514910
public static function str_split($s, $length = null)
	{
		if (! ReflectionTypeHint::isValid()) return false;
		if (is_null($s)) return $s;

		$length = ($length === null) ? 1 : intval($length);
		if ($length < 1) return false;
		#there are limits in regexp for {min,max}!
		if (preg_match_all('~.~suSX', $s, $m) === false) return false;
		if (function_exists('preg_last_error') && preg_last_error() !== PREG_NO_ERROR) return false;
		if ($length === 1) $a = $m[0];
		else
		{
			$a = array();
			for ($i = 0, $c = count($m[0]); $i < $c; $i += $length) $a[] = implode('', array_slice($m[0], $i, $length));
		}
		return $a;
	}
900262
public TextChunk[] splitAt(int i) {
        if (i < 1 || i >= this.getTextElements().size()) {
            throw new IllegalArgumentException();
        }

        TextChunk[] rv = new TextChunk[]{
                new TextChunk(this.getTextElements().subList(0, i)),
                new TextChunk(this.getTextElements().subList(i, this.getTextElements().size()))
        };
        return rv;
    }
1063047
public function decompress($content)
    {
        $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content));

        if (empty($archive) || !file_exists($archive)) {
            throw new Exception\RuntimeException('ZIP Archive not found');
        }

        $zip     = new ZipArchive();
        $res     = $zip->open($archive);

        $target = $this->getTarget();
        if (!empty($target) && !is_dir($target)) {
            $target = dirname($target);
        }

        if (!empty($target)) {
            $target = rtrim($target, '/\\') . DIRECTORY_SEPARATOR;
        }

        if (empty($target) || !is_dir($target)) {
            throw new Exception\RuntimeException('No target for ZIP decompression set');
        }

        if ($res !== true) {
            throw new Exception\RuntimeException($this->errorString($res));
        }

        $res = $zip->extractTo($target);
        if ($res !== true) {
            throw new Exception\RuntimeException($this->errorString($res));
        }

        $zip->close();
        return $target;
    }
235810
protected function splitDuration($seconds, $max)
    {
        if ($max < 1 || $seconds < 60) {
            return [$seconds];
        }
        
        $minutes = floor($seconds / 60);
        $seconds = $seconds % 60;
        if ($max < 2 || $minutes < 60) {
            return [$seconds, $minutes];
        }
        
        $hours = floor($minutes / 60);
        $minutes = $minutes % 60;
        if ($max < 3 || $hours < 24) {
            return [$seconds, $minutes, $hours];
        }
        
        $days = floor($hours / 24);
        $hours = $hours % 24;
        if ($max < 4 || $days < 7) {
            return [$seconds, $minutes, $hours, $days]; 
        }
        
        $weeks = floor($days / 7);
        $days = $days % 7;
        if ($max < 5 || $weeks < 52) {
            return [$seconds, $minutes, $hours, $days, $weeks];
        }
        
        $years = floor($weeks / 52);
        $weeks = $weeks % 52;
        return [$seconds, $minutes, $hours, $days, $weeks, $years];
    }
1068342
public static function byte2intSplit($input)
    {
        $l = strlen($input);
        if ($l <= 0) {
            // right...
            return 0;
        } elseif (($l % 4) != 0) {
            // invalid input
            return false;
        }
        $result = array();
        for ($i = 0; $i < $l; $i += 4) {
            $int_build  = (ord($input[$i]) << 24);
            $int_build += (ord($input[$i+1]) << 16);
            $int_build += (ord($input[$i+2]) << 8);
            $int_build += (ord($input[$i+3]));
            $result[] = $int_build;
        }

        return $result;
    }
330820
def split(self):
        """"""
        key = '%s/split' % self.key
        return self._server.query(key, method=self._server._session.put)