Passed
Push — master ( 484f87...7b874f )
by Tomasz
04:46 queued 01:00
created
web/lib/admin/view/TitledFormDecorator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 
4 4
 use web\lib\admin\view\html\Attribute;
5 5
 
6
-class TitledFormDecorator extends PageElementDecorator{
6
+class TitledFormDecorator extends PageElementDecorator {
7 7
     
8 8
     const BEFORE = 0;
9 9
     
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * 
35 35
      * @var array
36 36
      */
37
-    private $elements = array( self::BEFORE => array(), self::AFTER => array());
37
+    private $elements = array(self::BEFORE => array(), self::AFTER => array());
38 38
     
39 39
     /**
40 40
      * 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param string $class
43 43
      * @param string $title
44 44
      */
45
-    public function __construct($element, $title, $action, $class = '', $method = 'post', $charset = 'UTF-8'){
45
+    public function __construct($element, $title, $action, $class = '', $method = 'post', $charset = 'UTF-8') {
46 46
         parent::__construct($element, $class);
47 47
         $this->title = $title;
48 48
         $this->action = new Attribute('action', $action);
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
         $this->charset = new Attribute('accept-charset', $charset);
51 51
     }
52 52
     
53
-    public function addHtmlElement($element, $position = self::AFTER){
53
+    public function addHtmlElement($element, $position = self::AFTER) {
54 54
         $this->elements[$position][] = $element;
55 55
     }
56 56
     
57 57
     public function render() {
58 58
         ?>
59
-        <form enctype="multipart/form-data"<?php echo $this->action.$this->method.$this->charset; ?>>
59
+        <form enctype="multipart/form-data"<?php echo $this->action . $this->method . $this->charset; ?>>
60 60
             <fieldset<?php echo $this->class; ?>>
61 61
                 <legend>
62 62
                     <strong><?php echo $this->title; ?></strong>
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
                 <?php
66 66
                     foreach ($this->elements[self::BEFORE] as $element) {
67
-                        echo "\n".$element;
67
+                        echo "\n" . $element;
68 68
                     }
69 69
                 ?>
70 70
 
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
                     $this->element->render();
73 73
                 ?>
74 74
 
75
-                <?php if(count($this->elements[self::AFTER]) > 0){ ?>
75
+                <?php if (count($this->elements[self::AFTER]) > 0) { ?>
76 76
                 <div style="padding: 20px;">
77 77
                 <?php
78 78
                     foreach ($this->elements[self::AFTER] as $element) {
79
-                        echo "\n".$element;
79
+                        echo "\n" . $element;
80 80
                     }
81 81
                 ?>
82 82
                 </div>
Please login to merge, or discard this patch.
web/lib/admin/view/DatePicker.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
      * @param string $name Name of an input element
46 46
      * @param string $format Defines a format template for the date value
47 47
      */
48
-    public function __construct($name, $format='yyyy-MM-dd'){
48
+    public function __construct($name, $format = 'yyyy-MM-dd') {
49 49
         self::$COUNT++;
50
-        $this->id = self::INPUT_CLASS.'-'.self::$COUNT;
50
+        $this->id = self::INPUT_CLASS . '-' . self::$COUNT;
51 51
         $this->name = $name;
52 52
         $this->format = $format;
53 53
     }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * {@inheritDoc}
58 58
      * @see \web\lib\admin\view\PageElementInterface::render()
59 59
      */
60
-    public function render(){
60
+    public function render() {
61 61
         echo $this;
62 62
         
63 63
         /*?>
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         */
70 70
     }
71 71
     
72
-    public function __toString(){
72
+    public function __toString() {
73 73
         $div = new CompositeTag('div');
74 74
         $div->addAttribute('class', self::BLOCK_CLASS);
75 75
             $input = new UnaryTag('input');
Please login to merge, or discard this patch.
web/lib/admin/view/InfoBlockTable.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use web\lib\admin\view\html\Table;
5 5
 use web\lib\admin\view\html\Row;
6 6
 
7
-class InfoBlockTable implements PageElementInterface{
7
+class InfoBlockTable implements PageElementInterface {
8 8
     
9 9
     /**
10 10
      * 
@@ -18,22 +18,22 @@  discard block
 block discarded – undo
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,  PageElementInterface::INFOBLOCK_CLASS);
24
+        $this->decorator = new TitledBlockDecorator($this->table, $title, PageElementInterface::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, 'class', Table::TITLED_CELL_CLASS);
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
 }
Please login to merge, or discard this patch.
web/lib/admin/view/TitledBlockDecorator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace web\lib\admin\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
 block discarded – undo
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
         
Please login to merge, or discard this patch.
web/lib/admin/view/YesNoDialogBox.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             <button type="submit" name="<?php echo $this->controls[self::YES]['name']; ?>" value="<?php echo $this->controls[self::YES]['value']; ?>"><?php echo _('Yes'); ?></button>
41 41
         <?php if($this->controls[self::NO]['name'] == ''){ ?>
42 42
             <button class="<?php echo $this->id . '-close'; ?>" type="reset"><?php echo _('No'); ?></button>
43
-        <?php }else{ ?>
43
+        <?php } else{ ?>
44 44
             <button type="submit" name="<?php echo $this->controls[self::NO]['name']; ?>" value="<?php echo $this->controls[self::NO]['value']; ?>"><?php echo _('No'); ?></button>
45 45
         <?php }
46 46
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @author Zilvinas Vaira
7 7
  *
8 8
  */
9
-class YesNoDialogBox extends AbstractTextDialogBox{
9
+class YesNoDialogBox extends AbstractTextDialogBox {
10 10
 
11 11
     const NO = 0;
12 12
     const YES = 1;
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param string $action
26 26
      * @param string $text
27 27
      */
28
-    public function __construct($id, $action, $text){
28
+    public function __construct($id, $action, $text) {
29 29
         parent::__construct($action, $text);
30 30
         $this->id = $id;
31 31
     }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @param string $name
36 36
      * @param string $value
37 37
      */
38
-    public function setYesControl($name, $value){
38
+    public function setYesControl($name, $value) {
39 39
         $this->controls[self::YES]['name'] = $name;
40 40
         $this->controls[self::YES]['value'] = $value;
41 41
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param string $name
46 46
      * @param string $value
47 47
      */
48
-    public function setNoControl($name, $value){
48
+    public function setNoControl($name, $value) {
49 49
         $this->controls[self::NO]['name'] = $name;
50 50
         $this->controls[self::NO]['value'] = $value;
51 51
     }
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      * {@inheritDoc}
56 56
      * @see \web\lib\admin\view\AbstractDialogBox::renderControls()
57 57
      */
58
-    protected function renderControls(){
58
+    protected function renderControls() {
59 59
         ?>
60 60
             <button type="submit" name="<?php echo $this->controls[self::YES]['name']; ?>" value="<?php echo $this->controls[self::YES]['value']; ?>"><?php echo _('Yes'); ?></button>
61
-        <?php if($this->controls[self::NO]['name'] == ''){ ?>
61
+        <?php if ($this->controls[self::NO]['name'] == '') { ?>
62 62
             <button class="<?php echo $this->id . '-close'; ?>" type="reset"><?php echo _('No'); ?></button>
63
-        <?php }else{ ?>
63
+        <?php } else { ?>
64 64
             <button type="submit" name="<?php echo $this->controls[self::NO]['name']; ?>" value="<?php echo $this->controls[self::NO]['value']; ?>"><?php echo _('No'); ?></button>
65 65
         <?php }
66 66
     }
Please login to merge, or discard this patch.
web/lib/admin/view/PageElementDecorator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 
4 4
 use web\lib\admin\view\html\Attribute;
5 5
 
6
-abstract class PageElementDecorator implements PageElementInterface{
6
+abstract class PageElementDecorator implements PageElementInterface {
7 7
     
8 8
     /**
9 9
      * 
Please login to merge, or discard this patch.
web/lib/admin/view/html/Table.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     
30 30
     /**
31 31
      * 
32
-     * @return number
32
+     * @return integer
33 33
      */
34 34
     public function size(){
35 35
         return count($this->rows);
@@ -53,7 +53,6 @@  discard block
 block discarded – undo
53 53
     
54 54
     /**
55 55
      * 
56
-     * @param array $row
57 56
      */
58 57
     public function addRowArray($cells){
59 58
         $this->addRow(new Row($cells));
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @author Zilvinas Vaira
6 6
  *
7 7
  */
8
-class Table extends Tag{
8
+class Table extends Tag {
9 9
     
10 10
     const TITLED_CELL_CLASS = 'sb-titled-cell';
11 11
     
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      * 
25 25
      * @param array $rows
26 26
      */
27
-    public function __construct($rows = array()){
27
+    public function __construct($rows = array()) {
28 28
         parent::__construct('table');
29 29
         $this->setRows($rows);
30 30
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * 
34 34
      * @return number
35 35
      */
36
-    public function size(){
36
+    public function size() {
37 37
         return count($this->rows);
38 38
     }
39 39
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
      * @param int $row
43 43
      * @param string $column
44 44
      */
45
-    private function createRow($row, $column){
46
-        if(!in_array($column, $this->columns)){
45
+    private function createRow($row, $column) {
46
+        if (!in_array($column, $this->columns)) {
47 47
             $this->columns [] = $column;
48 48
         }
49
-        if(!isset($this->rows[$row])){
49
+        if (!isset($this->rows[$row])) {
50 50
             $this->rows [$row] = new Row();
51 51
         }
52 52
     }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * @param string $column
58 58
      * @param UnaryTag $element
59 59
      */
60
-    public function addToCell($row, $column, $element){
60
+    public function addToCell($row, $column, $element) {
61 61
         $this->createRow($row, $column);
62 62
         $this->rows[$row]->addToCell($column, $element);
63 63
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param string $column
69 69
      * @return \web\lib\admin\view\html\CompositeTag
70 70
      */
71
-    public function getCell($row, $column){
71
+    public function getCell($row, $column) {
72 72
         $this->createRow($row, $column);
73 73
         return $this->rows[$row]->getCell($column);
74 74
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * 
78 78
      * @param array $row
79 79
      */
80
-    public function addRowArray($cells){
80
+    public function addRowArray($cells) {
81 81
         $this->addRow(new Row($cells));
82 82
     }
83 83
     
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @param Row $row
87 87
      */
88
-    public function addRow($row){
89
-        if(count($row->size())>0){
88
+    public function addRow($row) {
89
+        if (count($row->size()) > 0) {
90 90
             $this->rows [] = $row;
91 91
             $this->setColumns($row);
92 92
         }
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      * 
97 97
      * @param array $rows
98 98
      */
99
-    public function setRows($rows){
100
-        if(count($rows)>0){
99
+    public function setRows($rows) {
100
+        if (count($rows) > 0) {
101 101
             foreach ($rows as $cells) {
102 102
                 $this->addRowArray($cells);
103 103
             }
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
      * 
109 109
      * @param Row $row
110 110
      */
111
-    private function setColumns($row){
111
+    private function setColumns($row) {
112 112
         $cells = $row->getCells();
113 113
         foreach ($cells as $key => $value) {
114
-            if(!in_array($key, $this->columns)){
114
+            if (!in_array($key, $this->columns)) {
115 115
                 $this->columns [] = $key;
116 116
             }
117 117
         }
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
      * 
122 122
      * @return string
123 123
      */
124
-    protected function composeInnerString(){
124
+    protected function composeInnerString() {
125 125
         $innerString = "";
126 126
         foreach ($this->rows as $row) {
127 127
             $row->setColumns($this->columns);
128
-            $row->setTab("\t".$this->tab);
128
+            $row->setTab("\t" . $this->tab);
129 129
             $innerString .= $row;
130 130
         }
131 131
         return $innerString;
Please login to merge, or discard this patch.
tests/unit/web/lib/admin/view/InstitutionPageBuilderTest.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     private function valid_IdP($input, $owner){
17 17
         if ($input == 1){
18 18
             return new MockInstitution();
19
-        }else{
19
+        } else{
20 20
             throw new Exception('IdP '.$input.' not found in database!');
21 21
         }
22 22
     }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      * @param unknown $input
16 16
      * @param unknown $owner
17 17
      * @throws Exception
18
-     * @return mixed
18
+     * @return MockInstitution
19 19
      */
20 20
     private function valid_IdP($input, $owner){
21 21
         if ($input == 1){
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 use web\lib\admin\view\DefaultHtmlPage;
4 4
 use web\lib\admin\view\InstitutionPageBuilder;
5 5
 
6
-class MockValidateInstitutionPageBuilder extends InstitutionPageBuilder{
6
+class MockValidateInstitutionPageBuilder extends InstitutionPageBuilder {
7 7
     
8
-    protected function validateInstitution(){
8
+    protected function validateInstitution() {
9 9
         $this->institution = $this->valid_IdP($_GET['inst_id'], $_SESSION['user']);
10 10
     }
11 11
     
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
      * @throws Exception
17 17
      * @return mixed
18 18
      */
19
-    private function valid_IdP($input, $owner){
20
-        if ($input == 1){
19
+    private function valid_IdP($input, $owner) {
20
+        if ($input == 1) {
21 21
             return new MockInstitution();
22
-        }else{
23
-            throw new Exception('IdP '.$input.' not found in database!');
22
+        } else {
23
+            throw new Exception('IdP ' . $input . ' not found in database!');
24 24
         }
25 25
     }
26 26
     
27 27
 }
28 28
 
29
-class MockInstitution{
29
+class MockInstitution {
30 30
     public $name = "Test name";
31 31
 }
32 32
 
33
-class InstitutionPageBuilderTest extends \PHPUnit_Framework_TestCase{
33
+class InstitutionPageBuilderTest extends \PHPUnit_Framework_TestCase {
34 34
     
35 35
     protected function setUp() {
36 36
         $_SESSION['user'] = "user";
37 37
     }
38 38
     
39
-    public function testConstructorSuccess(){
40
-        $_GET['inst_id']=1;
39
+    public function testConstructorSuccess() {
40
+        $_GET['inst_id'] = 1;
41 41
         $builder = new MockValidateInstitutionPageBuilder(new DefaultHtmlPage("Testing Page"));
42 42
         $this->assertTrue($builder->isReady());
43 43
     }
44 44
     
45
-    public function testConstructorFailure(){
46
-        $_GET['inst_id']=-1;
45
+    public function testConstructorFailure() {
46
+        $_GET['inst_id'] = -1;
47 47
         $builder = new MockValidateInstitutionPageBuilder(new DefaultHtmlPage("Testing Page"));
48 48
         $this->assertFalse($builder->isReady());
49 49
         
Please login to merge, or discard this patch.
web/admin/API.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@
 block discarded – undo
41 41
         $leftNum = (int) preg_replace($pat, $rep, $left);
42 42
         $rightNum = (int) preg_replace($pat, $rep, $right);
43 43
         return ($left != $leftNum && $right != $rightNum) ?
44
-                $leftNum - $rightNum :
45
-                strcmp($left, $right);
44
+                $leftNum - $rightNum : strcmp($left, $right);
46 45
     }
47 46
 
48 47
     
Please login to merge, or discard this patch.