mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 12:10:10 +02:00
Applied fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
3663603b80
commit
fe1f144ec3
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Creational\AbstractFactory;
|
||||
|
||||
/**
|
||||
* class AbstractFactory
|
||||
* class AbstractFactory.
|
||||
*
|
||||
* Sometimes also known as "Kit" in a GUI libraries.
|
||||
*
|
||||
@@ -20,7 +20,7 @@ namespace DesignPatterns\Creational\AbstractFactory;
|
||||
abstract class AbstractFactory
|
||||
{
|
||||
/**
|
||||
* Creates a text component
|
||||
* Creates a text component.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
@@ -29,7 +29,7 @@ abstract class AbstractFactory
|
||||
abstract public function createText($content);
|
||||
|
||||
/**
|
||||
* Creates a picture component
|
||||
* Creates a picture component.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $name
|
||||
|
@@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Html;
|
||||
use DesignPatterns\Creational\AbstractFactory\Picture as BasePicture;
|
||||
|
||||
/**
|
||||
* Class Picture
|
||||
* Class Picture.
|
||||
*
|
||||
* Picture is a concrete image for HTML rendering
|
||||
*/
|
||||
class Picture extends BasePicture
|
||||
{
|
||||
/**
|
||||
* some crude rendering from HTML output
|
||||
* some crude rendering from HTML output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@@ -5,19 +5,19 @@ namespace DesignPatterns\Creational\AbstractFactory\Html;
|
||||
use DesignPatterns\Creational\AbstractFactory\Text as BaseText;
|
||||
|
||||
/**
|
||||
* Class Text
|
||||
* Class Text.
|
||||
*
|
||||
* Text is a concrete text for HTML rendering
|
||||
*/
|
||||
class Text extends BaseText
|
||||
{
|
||||
/**
|
||||
* some crude rendering from HTML output
|
||||
* some crude rendering from HTML output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return '<div>' . htmlspecialchars($this->text) . '</div>';
|
||||
return '<div>'.htmlspecialchars($this->text).'</div>';
|
||||
}
|
||||
}
|
||||
|
@@ -3,14 +3,14 @@
|
||||
namespace DesignPatterns\Creational\AbstractFactory;
|
||||
|
||||
/**
|
||||
* Class HtmlFactory
|
||||
* Class HtmlFactory.
|
||||
*
|
||||
* HtmlFactory is a concrete factory for HTML component
|
||||
*/
|
||||
class HtmlFactory extends AbstractFactory
|
||||
{
|
||||
/**
|
||||
* Creates a picture component
|
||||
* Creates a picture component.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $name
|
||||
@@ -23,7 +23,7 @@ class HtmlFactory extends AbstractFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a text component
|
||||
* Creates a text component.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
|
@@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Json;
|
||||
use DesignPatterns\Creational\AbstractFactory\Picture as BasePicture;
|
||||
|
||||
/**
|
||||
* Class Picture
|
||||
* Class Picture.
|
||||
*
|
||||
* Picture is a concrete image for JSON rendering
|
||||
*/
|
||||
class Picture extends BasePicture
|
||||
{
|
||||
/**
|
||||
* some crude rendering from JSON output
|
||||
* some crude rendering from JSON output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Json;
|
||||
use DesignPatterns\Creational\AbstractFactory\Text as BaseText;
|
||||
|
||||
/**
|
||||
* Class Text
|
||||
* Class Text.
|
||||
*
|
||||
* Text is a text component with a JSON rendering
|
||||
*/
|
||||
class Text extends BaseText
|
||||
{
|
||||
/**
|
||||
* some crude rendering from JSON output
|
||||
* some crude rendering from JSON output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@@ -3,16 +3,15 @@
|
||||
namespace DesignPatterns\Creational\AbstractFactory;
|
||||
|
||||
/**
|
||||
* Class JsonFactory
|
||||
* Class JsonFactory.
|
||||
*
|
||||
* JsonFactory is a factory for creating a family of JSON component
|
||||
* (example for ajax)
|
||||
*/
|
||||
class JsonFactory extends AbstractFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a picture component
|
||||
* Creates a picture component.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $name
|
||||
@@ -25,7 +24,7 @@ class JsonFactory extends AbstractFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a text component
|
||||
* Creates a text component.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
|
@@ -3,16 +3,15 @@
|
||||
namespace DesignPatterns\Creational\AbstractFactory;
|
||||
|
||||
/**
|
||||
* Interface MediaInterface
|
||||
* Interface MediaInterface.
|
||||
*
|
||||
* This contract is not part of the pattern, in general case, each component
|
||||
* are not related
|
||||
*/
|
||||
interface MediaInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* some crude rendering from JSON or html output (depended on concrete class)
|
||||
* some crude rendering from JSON or html output (depended on concrete class).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@@ -3,11 +3,10 @@
|
||||
namespace DesignPatterns\Creational\AbstractFactory;
|
||||
|
||||
/**
|
||||
* Class Picture
|
||||
* Class Picture.
|
||||
*/
|
||||
abstract class Picture implements MediaInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@@ -7,7 +7,7 @@ use DesignPatterns\Creational\AbstractFactory\HtmlFactory;
|
||||
use DesignPatterns\Creational\AbstractFactory\JsonFactory;
|
||||
|
||||
/**
|
||||
* AbstractFactoryTest tests concrete factories
|
||||
* AbstractFactoryTest tests concrete factories.
|
||||
*/
|
||||
class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -15,7 +15,7 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
return array(
|
||||
array(new JsonFactory()),
|
||||
array(new HtmlFactory())
|
||||
array(new HtmlFactory()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
$article = array(
|
||||
$factory->createText('Lorem Ipsum'),
|
||||
$factory->createPicture('/image.jpg', 'caption'),
|
||||
$factory->createText('footnotes')
|
||||
$factory->createText('footnotes'),
|
||||
);
|
||||
|
||||
$this->assertContainsOnly('DesignPatterns\Creational\AbstractFactory\MediaInterface', $article);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Creational\AbstractFactory;
|
||||
|
||||
/**
|
||||
* Class Text
|
||||
* Class Text.
|
||||
*/
|
||||
abstract class Text implements MediaInterface
|
||||
{
|
||||
|
Reference in New Issue
Block a user