Get file contents
@param int|null $size The file size [optionnal]
@return bool|string File contents | If an error was generated
@throws Server500
167622
public function read(int $size = null)
    {
        if ($this->file == null) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Cannot read file for unopened file",
                "solution" =>
                    "Please open the file with [FileListener::open] before trying to get read it.")));
        }
        if ($size === null) {
            return (fread($this->file, $this->size()));
        } else {
            return (fread($this->file, $size));
        }
    }
845529
public function getPortraitFile($size)
    {
        $filename = $this->filename;

        //get file extension
        $extension = explode('.', $filename);
        $extension = array_pop($extension);

        //remove extension
        $name = preg_replace('#\.[^.]*$#', '', $filename);

        $filename = $name.'_'.$size.'.'.$extension;

        return $filename;
    }
240587
public function generate($size)
    {
        if ($size == 0) {
            return static::emptyValue($size);
        }
        $file = fopen(static::$file, 'rb');
        if (!$file) {
            return static::emptyValue($size);
        }
        if (function_exists('stream_set_read_buffer')) {
            stream_set_read_buffer($file, 0);
        }
        $result = fread($file, $size);
        fclose($file);

        return $result;
    }
927152
public function thumbnailUrl($size = null, $icon = false)
    {
        $data = wp_get_attachment_image_src(get_post_thumbnail_id($this->id()), $size, $icon);

        return (empty($data)) ? null : $data[0];
    }
696460
protected function getByteSize($size)
    {
        if (! preg_match('/(\d+)\s*([tgkmbi]{1,3})/i', $size, $result)) {
            return $size;
        }

        $mapping = $this->mapping[strtolower($result[2])];
        return pow($mapping[0], $mapping[1]) * $result[1];
    }
925691
public function getContent($h)
	{
		$e = $this->getRawElement($h);
		if($e != null)
		{
			if($e[0] == self::TYPE_FILE)
				return file_get_contents($this->dir . $e[1]);
			elseif($e[0] == self::TYPE_MEM)
				return $e[1];
		}
		return null;
	}
1237221
public function getCoverURL($size = 'large')
    {
        $coverFilename = $this->_mixer->getCoverFile($size);

        $url = $this->getPathURL($coverFilename, true);

        return $url;
    }
30296
static function read($filename) {
        if (file_exists($filename) && self::isReadable($filename)) {
            return file_get_contents($filename);
        }

        return NULL;
    }
1293749
public function getOldestArticles(int $size = null) : Collection
    {
        $size = $size ?? $this->articles->count();
        return $this->articles->values()->take($size);
    }
317071
protected function readBodyRaw($size)
    {
        $data = substr($this->body, $this->position, $size);
        $this->position += $size;
        return $data;
    }
384315
public function size($size = null)
    {
        /* To do: function should be called ratio() */
        if (is_null($size)) {
            if (isset($this->size_attribute)) {
                return $this->size_attribute;
            } else {
                return;
            }
        }
        $size = $this->parseSize($size)->raw;
        $this->size_attribute = $size;
        $this->todo('resize');

        return $this;
    }
406969
public function gets($size)
    {
        $this->_checkStream();
        $data = @fgets($this->_stream, $size);
        if ($data === false) {
            throw new Client\Exception('Error reading data from socket');
        }
        return $data;
    }
469268
public function fileSize($size) {
        if (!$size) {
            return '0 ' . $this->_sizes[0];
        }
        return round($size/pow(1024, ($i = floor(log($size, 1024)))), $i > 1 ? 2 : 0) .
            ' ' . $this->_sizes[$i];
    }
501940
public function chunk($size){
		
		$outer = new static();
		$chunks = \array_chunk($this->_Arr, $size);
		
		foreach($chunks as $chunk){
			$outer->pushBack(new static($chunk));
		}
		
		return $outer;
		
	}
806656
public function parseFileSize($size)
    {
        $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size.
        $size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size.
        if ($unit) {
            // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by.
            return round($size * pow(1024, stripos('bkmgtpezy', $unit[0])));
        } else {
            return round($size);
        }
    }
995006
public function getThumbnail($size) {
		switch ($size) {
			case 'thumb':
				$thumb = $this->thumbnail;
				break;
			case 'small':
				$thumb = $this->smallthumb;
				break;
			case 'large':
				$thumb = $this->largethumb;
				break;
			default:
				return '';
				break;
		}

		if (!$thumb) {
			return '';
		}

		$file = new ElggFile();
		$file->owner_guid = $this->getOwnerGUID();
		$file->setFilename($thumb);
		return $file->grabFile();
	}
662913
protected function getResponse($size = 128)
    {
        $response = fgets($this->pop_conn, $size);
        if ($this->do_debug >= 1) {
            echo 'Server -> Client: ', $response;
        }

        return $response;
    }