for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
*/
namespace midgard\portable\api;
use midgard\portable\storage\connection;
use midgard_connection;
class blob
{
public $parentguid;
public $content;
protected $attachment;
public function __construct(attachment $attachment, string $encoding = 'UTF-8')
$encoding
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function __construct(attachment $attachment, /** @scrutinizer ignore-unused */ string $encoding = 'UTF-8')
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$this->attachment = $attachment;
}
public function read_content() : ?string
if ($this->exists()) {
return file_get_contents($this->get_path());
return null;
public function write_content($content) : bool
return file_put_contents($this->get_path(), $content) !== false;
public function remove_file()
public function get_handler(string $mode = 'w')
return fopen($this->get_path(), $mode);
public function get_path() : string
if (empty($this->attachment->location)) {
$location = connection::generate_guid();
$subdir1 = strtoupper($location[0]);
$subdir2 = strtoupper($location[1]);
$this->attachment->location = $subdir1 . DIRECTORY_SEPARATOR . $subdir2 . DIRECTORY_SEPARATOR . $location;
$blobdir = midgard_connection::get_instance()->config->blobdir;
return $blobdir . DIRECTORY_SEPARATOR . $this->attachment->location;
public function exists() : bool
return file_exists($this->get_path());
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.