mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-22 16:54:13 +01:00
37 lines
681 B
PHP
37 lines
681 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Creational\AbstractFactory;
|
|
|
|
/**
|
|
* Class HtmlFactory.
|
|
*
|
|
* HtmlFactory is a concrete factory for HTML component
|
|
*/
|
|
class HtmlFactory extends AbstractFactory
|
|
{
|
|
/**
|
|
* Creates a picture component.
|
|
*
|
|
* @param string $path
|
|
* @param string $name
|
|
*
|
|
* @return Html\Picture|Picture
|
|
*/
|
|
public function createPicture($path, $name = '')
|
|
{
|
|
return new Html\Picture($path, $name);
|
|
}
|
|
|
|
/**
|
|
* Creates a text component.
|
|
*
|
|
* @param string $content
|
|
*
|
|
* @return Html\Text|Text
|
|
*/
|
|
public function createText($content)
|
|
{
|
|
return new Html\Text($content);
|
|
}
|
|
}
|