-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
92 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the badge-poser package. | ||
* | ||
* (c) PUGX <http://pugx.github.io/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace PUGX\Poser; | ||
|
||
/** | ||
* Class Image, an Image value Object | ||
* | ||
* @author Claudio D'Alicandro <[email protected]> | ||
* @author Giulio De Donato <[email protected]> | ||
*/ | ||
class Image | ||
{ | ||
/** | ||
* @var string $content | ||
*/ | ||
private $content; | ||
/** | ||
* @var string $format | ||
*/ | ||
private $format; | ||
|
||
/** | ||
* @param string $content | ||
* @param string $format | ||
*/ | ||
private function __construct($content, $format) | ||
{ | ||
$this->content = $content; | ||
$this->format = $format; | ||
} | ||
|
||
/** | ||
* Returns the image content as binary string | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->content; | ||
} | ||
|
||
/** | ||
* Factory method | ||
* | ||
* @param string $content | ||
* @param string $format | ||
* | ||
* @return Image | ||
*/ | ||
public static function createFromString($content, $format) | ||
{ | ||
return new self($content, $format); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getFormat() | ||
{ | ||
return $this->format; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters