mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 19:50:12 +02:00
Cleaned up code to be consistent, inc. adding docblocs, using PSR naming conventions & typos
Docblocs benefits: - IDE auto complete gives info on type etc - Auto documentation on CI
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* DesignPatternPHP
|
||||
*/
|
||||
|
||||
namespace DesignPatterns\AbstractFactory\Html;
|
||||
|
||||
use DesignPatterns\AbstractFactory\Picture as BasePicture;
|
||||
|
||||
/**
|
||||
* Class Picture
|
||||
*
|
||||
* Picture is a concrete image for HTML rendering
|
||||
*
|
||||
* @package DesignPatterns\AbstractFactory\Html
|
||||
*/
|
||||
class Picture extends BasePicture
|
||||
{
|
||||
|
||||
// some crude rendering from HTML output
|
||||
/**
|
||||
* some crude rendering from HTML output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return sprintf('<img src="%s" title="$s"/>', $this->_path, $this->_name);
|
||||
|
@@ -1,22 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* DesignPatternPHP
|
||||
*/
|
||||
|
||||
namespace DesignPatterns\AbstractFactory\Html;
|
||||
|
||||
use DesignPatterns\AbstractFactory\Text as BaseText;
|
||||
|
||||
/**
|
||||
* Class Text
|
||||
*
|
||||
* Text is a concrete text for HTML rendering
|
||||
*
|
||||
* @package DesignPatterns\AbstractFactory\Html
|
||||
*/
|
||||
class Text extends BaseText
|
||||
{
|
||||
|
||||
/**
|
||||
* some crude rendering from HTML output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return "<div>" . htmlspecialchars($this->_text) . '</div>';
|
||||
return '<div>' . htmlspecialchars($this->_text) . '</div>';
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user