@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param string $name |
| 34 | 34 | */ |
| 35 | - public function __construct($name){ |
|
| 35 | + public function __construct($name) { |
|
| 36 | 36 | $this->name = $name; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function setTab($tab){ |
|
| 39 | + public function setTab($tab) { |
|
| 40 | 40 | $this->tab = $tab; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param string $name |
| 46 | 46 | * @param string $value |
| 47 | 47 | */ |
| 48 | - public function addAttribute($name, $value){ |
|
| 48 | + public function addAttribute($name, $value) { |
|
| 49 | 49 | $this->attributes [] = new Attribute($name, $value); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -54,18 +54,18 @@ discard block |
||
| 54 | 54 | * @param string $attributeString |
| 55 | 55 | * @return string |
| 56 | 56 | */ |
| 57 | - protected function composeTagString($attributeString){ |
|
| 58 | - return "\n" . $this->tab . "<".$this->name.$attributeString.">"; |
|
| 57 | + protected function composeTagString($attributeString) { |
|
| 58 | + return "\n" . $this->tab . "<" . $this->name . $attributeString . ">"; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function __toString(){ |
|
| 61 | + public function __toString() { |
|
| 62 | 62 | $attributeString = ""; |
| 63 | 63 | foreach ($this->attributes as $attribute) { |
| 64 | 64 | $attributeString .= $attribute; |
| 65 | 65 | } |
| 66 | - if(isset($this->name)){ |
|
| 66 | + if (isset($this->name)) { |
|
| 67 | 67 | return $this->composeTagString($attributeString); |
| 68 | - }else{ |
|
| 68 | + } else { |
|
| 69 | 69 | return ""; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * {@inheritDoc} |
| 76 | 76 | * @see \lib\html\PageElement::render() |
| 77 | 77 | */ |
| 78 | - public function render(){ |
|
| 78 | + public function render() { |
|
| 79 | 79 | echo $this->__toString(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function __toString(){ |
| 36 | 36 | if(!empty($this->name) && !empty($this->value)){ |
| 37 | 37 | return ' ' . $this->name . '="' . $this->value . '"'; |
| 38 | - }else{ |
|
| 38 | + } else{ |
|
| 39 | 39 | return ''; |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function __toString(){ |
| 36 | 36 | if(!empty($this->name) && !empty($this->value)){ |
| 37 | 37 | return ' ' . $this->name . '="' . $this->value . '"'; |
| 38 | - }else{ |
|
| 38 | + } else{ |
|
| 39 | 39 | return ''; |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @author Zilvinas Vaira |
| 8 | 8 | * |
| 9 | 9 | */ |
| 10 | -class Attribute implements HtmlElement{ |
|
| 10 | +class Attribute implements HtmlElement { |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | * @param string $name |
| 27 | 27 | * @param string $value |
| 28 | 28 | */ |
| 29 | - public function __construct($name, $value){ |
|
| 29 | + public function __construct($name, $value) { |
|
| 30 | 30 | $this->name = str_replace('"', '', $name); |
| 31 | 31 | $this->value = str_replace('"', '', $value); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function __toString(){ |
|
| 35 | - if(!empty($this->name) && !empty($this->value)){ |
|
| 34 | + public function __toString() { |
|
| 35 | + if (!empty($this->name) && !empty($this->value)) { |
|
| 36 | 36 | return ' ' . $this->name . '="' . $this->value . '"'; |
| 37 | - }else{ |
|
| 37 | + } else { |
|
| 38 | 38 | return ''; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -class JSButton extends Button{ |
|
| 9 | +class JSButton extends Button { |
|
| 10 | 10 | |
| 11 | 11 | const REVOKE_CREDENTIAL_ACTION = 'revokeCredential'; |
| 12 | 12 | const DELETE_USER_ACTION = 'deleteUser'; |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | private $action = ""; |
| 18 | 18 | |
| 19 | - public function __construct($title, $action, $name = '', $value = '', $type = 'button', $class = ''){ |
|
| 19 | + public function __construct($title, $action, $name = '', $value = '', $type = 'button', $class = '') { |
|
| 20 | 20 | parent::__construct($title, $type, $name, $value, $class); |
| 21 | 21 | $this->action = $action; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | protected function composeNameValueString() { |
| 25 | - return ' onclick="'.$this->action.'(\''.$this->name.'\',\''.$this->value.'\')"'; |
|
| 25 | + return ' onclick="' . $this->action . '(\'' . $this->name . '\',\'' . $this->value . '\')"'; |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | use lib\view\html\Table; |
| 5 | 5 | use lib\view\html\Row; |
| 6 | 6 | |
| 7 | -class InfoBlockTable implements PageElement{ |
|
| 7 | +class InfoBlockTable implements PageElement { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * |
@@ -18,22 +18,22 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | private $decorator; |
| 20 | 20 | |
| 21 | - public function __construct($title){ |
|
| 21 | + public function __construct($title) { |
|
| 22 | 22 | $this->table = new Table(); |
| 23 | 23 | $this->table->addAttribute("cellpadding", 5); |
| 24 | - $this->decorator = new TitledBlockDecorator($this->table, $title, PageElement::INFOBLOCK_CLASS); |
|
| 24 | + $this->decorator = new TitledBlockDecorator($this->table, $title, PageElement::INFOBLOCK_CLASS); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param array $rowArray |
| 29 | 29 | */ |
| 30 | - public function addRow($rowArray){ |
|
| 30 | + public function addRow($rowArray) { |
|
| 31 | 31 | $row = new Row($rowArray); |
| 32 | 32 | $row->addCellAttribute(0, 'style', 'font-weight:bold;'); |
| 33 | 33 | $this->table->addRow($row); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function render(){ |
|
| 36 | + public function render() { |
|
| 37 | 37 | $this->decorator->render(); |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @author Zilvinas Vaira |
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | -interface Page{ |
|
| 9 | +interface Page { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace lib\view; |
| 3 | 3 | |
| 4 | -class TitledBlockDecorator extends PageElementDecorator{ |
|
| 4 | +class TitledBlockDecorator extends PageElementDecorator { |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @param string $class |
| 16 | 16 | * @param string $title |
| 17 | 17 | */ |
| 18 | - public function __construct($element, $title, $class = ""){ |
|
| 18 | + public function __construct($element, $title, $class = "") { |
|
| 19 | 19 | parent::__construct($element, $class); |
| 20 | 20 | $this->title = $title; |
| 21 | 21 | |
@@ -3,13 +3,13 @@ discard block |
||
| 3 | 3 | use lib\view\html\CompositeTag; |
| 4 | 4 | use lib\view\html\Tag; |
| 5 | 5 | |
| 6 | -class CompositeTagTest extends \PHPUnit_Framework_TestCase{ |
|
| 6 | +class CompositeTagTest extends \PHPUnit_Framework_TestCase { |
|
| 7 | 7 | |
| 8 | 8 | private $compositeTag; |
| 9 | 9 | |
| 10 | 10 | private $tag; |
| 11 | 11 | |
| 12 | - protected function setup(){ |
|
| 12 | + protected function setup() { |
|
| 13 | 13 | $this->compositeTag = new CompositeTag('div'); |
| 14 | 14 | $this->tag = new Tag('p'); |
| 15 | 15 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $this->assertTrue(in_array($this->tag, $tags)); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function testToString(){ |
|
| 27 | + public function testToString() { |
|
| 28 | 28 | $string = $this->compositeTag->__toString(); |
| 29 | 29 | $this->assertEquals('<div>', substr(trim($string), 0, 5)); |
| 30 | 30 | $this->assertEquals('</div>', substr(trim($string), -6)); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $this->assertEquals('<div>', substr(trim($string), 0, 5)); |
| 35 | 35 | $this->assertEquals('</div>', substr(trim($string), -6)); |
| 36 | 36 | |
| 37 | - $string = str_replace(array('<div>','</div>'), '', $string); |
|
| 37 | + $string = str_replace(array('<div>', '</div>'), '', $string); |
|
| 38 | 38 | $this->assertEquals('<p>', substr(trim($string), 0, 3)); |
| 39 | 39 | $this->assertEquals('</p>', substr(trim($string), -4)); |
| 40 | 40 | } |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use lib\view\html\Button; |
| 4 | 4 | |
| 5 | -class ButtonTest extends \PHPUnit_Framework_TestCase{ |
|
| 5 | +class ButtonTest extends \PHPUnit_Framework_TestCase { |
|
| 6 | 6 | |
| 7 | 7 | private $title; |
| 8 | 8 | |
| 9 | - protected function setup(){ |
|
| 9 | + protected function setup() { |
|
| 10 | 10 | $this->title = 'Some title'; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | $button = new Button($this->title, $type, $name, $value, $class); |
| 28 | 28 | $string = $button->__toString(); |
| 29 | 29 | |
| 30 | - $this->assertNotEquals(strpos($string, 'type="'.$type.'"'), false); |
|
| 31 | - $this->assertNotEquals(strpos($string, 'name="'.$name.'"'), false); |
|
| 32 | - $this->assertNotEquals(strpos($string, 'value="'.$value.'"'), false); |
|
| 33 | - $this->assertNotEquals(strpos($string, 'class="'.$class.'"'), false); |
|
| 30 | + $this->assertNotEquals(strpos($string, 'type="' . $type . '"'), false); |
|
| 31 | + $this->assertNotEquals(strpos($string, 'name="' . $name . '"'), false); |
|
| 32 | + $this->assertNotEquals(strpos($string, 'value="' . $value . '"'), false); |
|
| 33 | + $this->assertNotEquals(strpos($string, 'class="' . $class . '"'), false); |
|
| 34 | 34 | $this->assertNotEquals(strpos($string, $this->title), false); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -5,32 +5,32 @@ |
||
| 5 | 5 | |
| 6 | 6 | const CONFIG = ['APPEARANCE' => ['productname' => 'Test Product']]; |
| 7 | 7 | |
| 8 | -function valid_IdP($input, $owner){ |
|
| 9 | - if ($input == 1){ |
|
| 8 | +function valid_IdP($input, $owner) { |
|
| 9 | + if ($input == 1) { |
|
| 10 | 10 | return new MockInstitution(); |
| 11 | - }else{ |
|
| 12 | - throw new Exception('IdP '.$input.' not found in database!'); |
|
| 11 | + } else { |
|
| 12 | + throw new Exception('IdP ' . $input . ' not found in database!'); |
|
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -class MockInstitution{ |
|
| 16 | +class MockInstitution { |
|
| 17 | 17 | public $name = "Test name"; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -class InstitutionPageBuilderTest extends \PHPUnit_Framework_TestCase{ |
|
| 20 | +class InstitutionPageBuilderTest extends \PHPUnit_Framework_TestCase { |
|
| 21 | 21 | |
| 22 | 22 | protected function setup() { |
| 23 | 23 | $_SESSION['user'] = "user"; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function testConstructorSuccess(){ |
|
| 27 | - $_GET['inst_id']=1; |
|
| 26 | + public function testConstructorSuccess() { |
|
| 27 | + $_GET['inst_id'] = 1; |
|
| 28 | 28 | $builder = new InstitutionPageBuilder("Testing Page", PageBuilder::ADMIN_IDP_USERS); |
| 29 | 29 | $this->assertTrue($builder->isReady()); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function testConstructorFailure(){ |
|
| 33 | - $_GET['inst_id']=-1; |
|
| 32 | + public function testConstructorFailure() { |
|
| 33 | + $_GET['inst_id'] = -1; |
|
| 34 | 34 | $builder = new InstitutionPageBuilder("Testing Page", PageBuilder::ADMIN_IDP_USERS); |
| 35 | 35 | $this->assertFalse($builder->isReady()); |
| 36 | 36 | |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | function valid_IdP($input, $owner){ |
| 9 | 9 | if ($input == 1){ |
| 10 | 10 | return new MockInstitution(); |
| 11 | - }else{ |
|
| 11 | + } else{ |
|
| 12 | 12 | throw new Exception('IdP '.$input.' not found in database!'); |
| 13 | 13 | } |
| 14 | 14 | } |