mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 20:20:15 +02:00
start a restructure
This commit is contained in:
23
Creational/AbstractFactory/Html/Picture.php
Normal file
23
Creational/AbstractFactory/Html/Picture.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\AbstractFactory\Html;
|
||||
|
||||
use DesignPatterns\AbstractFactory\Picture as BasePicture;
|
||||
|
||||
/**
|
||||
* Class Picture
|
||||
*
|
||||
* Picture is a concrete image for HTML rendering
|
||||
*/
|
||||
class Picture extends BasePicture
|
||||
{
|
||||
/**
|
||||
* some crude rendering from HTML output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return sprintf('<img src="%s" title="$s"/>', $this->path, $this->name);
|
||||
}
|
||||
}
|
23
Creational/AbstractFactory/Html/Text.php
Normal file
23
Creational/AbstractFactory/Html/Text.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\AbstractFactory\Html;
|
||||
|
||||
use DesignPatterns\AbstractFactory\Text as BaseText;
|
||||
|
||||
/**
|
||||
* Class Text
|
||||
*
|
||||
* Text is a concrete text for HTML rendering
|
||||
*/
|
||||
class Text extends BaseText
|
||||
{
|
||||
/**
|
||||
* some crude rendering from HTML output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return '<div>' . htmlspecialchars($this->text) . '</div>';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user