Skip to content

Commit

Permalink
Improved code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
natepage committed Jan 16, 2017
1 parent 2265476 commit 612b7ba
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getType()
*/
public function setText($text = null)
{
if(null != $text){
if(null !== $text){
$this->text = $text;
}

Expand Down
10 changes: 3 additions & 7 deletions HtmlElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function load($name, array $parameters = array(), array $attributes = arr
/**
* {@inheritdoc}
*/
static public function create($type = null, $text = null, array $attributes = array(), array $children = array())
public static function create($type = null, $text = null, array $attributes = array(), array $children = array())
{
$htmlElement = new HtmlElement();

Expand All @@ -266,28 +266,23 @@ static public function create($type = null, $text = null, array $attributes = ar
*
* @throws InvalidArgumentsNumberException If the arguments length is more than 3
*/
static public function __callStatic($type, $arguments)
public static function __callStatic($type, $arguments)
{
switch(count($arguments)){
case 0:
return self::create($type);
break;
case 1:
return self::create($type, $arguments[0]);
break;
case 2:
return self::create($type, $arguments[0], $arguments[1]);
break;
case 3:
return self::create($type, $arguments[0], $arguments[1], $arguments[2]);
break;
default:
throw new InvalidArgumentsNumberException(sprintf(
'Maximum numbers of arguments is %d, [%d] given.',
3,
count($arguments)
));
break;
}
}

Expand Down Expand Up @@ -393,6 +388,7 @@ private function getInstance($name, array $parameters, $mainCall = false)
private function resolveElement($name, array $parameters, $mainCall = false)
{
$getCurrent = true;
$current = array();

if(is_array($name)){
$current = $name;
Expand Down
2 changes: 1 addition & 1 deletion HtmlElementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface HtmlElementInterface
*
* @return ElementInterface
*/
static public function create($type = null, $text = null, array $attributes = array(), array $children = array());
public static function create($type = null, $text = null, array $attributes = array(), array $children = array());

/**
* Load a html element.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# [PHP] Easy Html Element

An easy way to create simple or complex html elements in PHP.

[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
[![Build Status](https://travis-ci.org/natepage/easy-html-element.svg?branch=master)](https://travis-ci.org/natepage/easy-html-element)
[![SensioLabs Insight](https://img.shields.io/sensiolabs/i/1ca37d08-6889-4280-aa4c-5739bf2be48a.svg)](https://insight.sensiolabs.com/projects/1ca37d08-6889-4280-aa4c-5739bf2be48a)
[![Quality Score](https://img.shields.io/scrutinizer/g/natepage/easy-html-element.svg)](https://scrutinizer-ci.com/g/natepage/easy-html-element)

An easy way to create simple or complex html elements in PHP.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
</exclude>
</whitelist>
</filter>
</phpunit>
</phpunit>

0 comments on commit 612b7ba

Please sign in to comment.