Skip to content

Commit

Permalink
Remove redundant code & double doc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Apr 13, 2024
1 parent 8f6aabe commit 968f9e4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 55 deletions.
12 changes: 6 additions & 6 deletions src/EncodedImage.php
Expand Up @@ -21,29 +21,29 @@ public function __construct(
}

/**
* Return media (mime) type of encoed image data
* {@inheritdoc}
*
* @return string
* @see EncodedImageInterface::mediaType()
*/
public function mediaType(): string
{
return $this->mediaType;
}

/**
* Alias of self::mediaType()
* {@inheritdoc}
*
* @return string
* @see EncodedImageInterface::mimetype()
*/
public function mimetype(): string
{
return $this->mediaType();
}

/**
* Transform encoded image data into an data uri string
* {@inheritdoc}
*
* @return string
* @see EncodedImageInterface::toDataUri()
*/
public function toDataUri(): string
{
Expand Down
22 changes: 10 additions & 12 deletions src/File.php
Expand Up @@ -22,11 +22,9 @@ public function __construct(protected string $data)
}

/**
* Save encoded image data in file system
* {@inheritdoc}
*
* @codeCoverageIgnore
* @param string $filepath
* @return void
* @see FileInterface::save()
*/
public function save(string $filepath): void
{
Expand Down Expand Up @@ -54,39 +52,39 @@ public function save(string $filepath): void
}

/**
* Cast encoded image object to string
* {@inheritdoc}
*
* @return string
* @see FilterInterface::toString()
*/
public function toString(): string
{
return $this->data;
}

/**
* Create file pointer from encoded image
* {@inheritdoc}
*
* @return resource
* @see FilterInterface::toFilePointer()
*/
public function toFilePointer()
{
return $this->buildFilePointer($this->toString());
}

/**
* Return byte size of encoded image
* {@inheritdoc}
*
* @return int
* @see FileInterface::size()
*/
public function size(): int
{
return mb_strlen($this->data);
}

/**
* Cast encoded image object to string
* {@inheritdoc}
*
* @return string
* @see FileInterface::__toString()
*/
public function __toString(): string
{
Expand Down
38 changes: 1 addition & 37 deletions src/Interfaces/EncodedImageInterface.php
Expand Up @@ -21,45 +21,9 @@ public function mediaType(): string;
public function mimetype(): string;

/**
* Turn encoded image into DataUri format
* Transform encoded image data into an data uri string
*
* @return string
*/
public function toDataUri(): string;

/**
* Save encoded image in filesystem
*
* @param string $filepath
* @return void
*/
public function save(string $filepath): void;

/**
* Cast encoded image to string
*
* @return string
*/
public function toString(): string;

/**
* Return file pointer of encoded image data
*
* @return resource
*/
public function toFilePointer();

/**
* Return size in bytes of encoded image
*
* @return int
*/
public function size(): int;

/**
* Cast encoded image data to string
*
* @return string
*/
public function __toString(): string;
}

0 comments on commit 968f9e4

Please sign in to comment.