@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @author Zilvinas Vaira |
7 | 7 | * |
8 | 8 | */ |
9 | -class SessionStorage implements StorageInterface{ |
|
9 | +class SessionStorage implements StorageInterface { |
|
10 | 10 | |
11 | 11 | const INDEX = 'silverbullet-storage'; |
12 | 12 | const WIDE = 'wide'; |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param string $package |
43 | 43 | */ |
44 | - private function __construct($package = ""){ |
|
45 | - if(!isset($_SESSION)){ |
|
44 | + private function __construct($package = "") { |
|
45 | + if (!isset($_SESSION)) { |
|
46 | 46 | session_start(); |
47 | 47 | } |
48 | - if(!isset($_SESSION['silverbullet-storage'])){ |
|
48 | + if (!isset($_SESSION['silverbullet-storage'])) { |
|
49 | 49 | $_SESSION[self::INDEX] = array(); |
50 | 50 | $_SESSION[self::INDEX][self::WIDE] = array(); |
51 | 51 | $_SESSION[self::INDEX][self::SCOPED] = array(); |
52 | 52 | } |
53 | - if (!empty($package)){ |
|
54 | - if(!isset($_SESSION[self::INDEX][self::SCOPED][$package])){ |
|
53 | + if (!empty($package)) { |
|
54 | + if (!isset($_SESSION[self::INDEX][self::SCOPED][$package])) { |
|
55 | 55 | $_SESSION[self::INDEX][self::SCOPED][$package] = array(); |
56 | 56 | } |
57 | 57 | $this->session = &$_SESSION[self::INDEX][self::SCOPED][$package]; |
58 | - }else{ |
|
58 | + } else { |
|
59 | 59 | $this->session = &$_SESSION[self::INDEX][self::WIDE]; |
60 | 60 | } |
61 | 61 | $this->package = $package; |
@@ -66,22 +66,22 @@ discard block |
||
66 | 66 | * @param string $package |
67 | 67 | * @return SessionStorage |
68 | 68 | */ |
69 | - public static function getInstance($package = ""){ |
|
69 | + public static function getInstance($package = "") { |
|
70 | 70 | |
71 | - if(empty($package)){ |
|
72 | - if(empty(self::$instance)){ |
|
71 | + if (empty($package)) { |
|
72 | + if (empty(self::$instance)) { |
|
73 | 73 | self::$instance = new self($package); |
74 | 74 | } |
75 | 75 | return self::$instance; |
76 | - }else{ |
|
77 | - if(!isset(self::$pool[$package])){ |
|
76 | + } else { |
|
77 | + if (!isset(self::$pool[$package])) { |
|
78 | 78 | self::$pool[$package] = new self($package); |
79 | 79 | } |
80 | 80 | return self::$pool[$package]; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - public static function close(){ |
|
84 | + public static function close() { |
|
85 | 85 | session_unset(); |
86 | 86 | session_destroy(); |
87 | 87 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * {@inheritDoc} |
92 | 92 | * @see \web\lib\admin\domain\storage\StorageInterface::put() |
93 | 93 | */ |
94 | - public function put($identifier, $object){ |
|
94 | + public function put($identifier, $object) { |
|
95 | 95 | $this->session[$identifier] = $object; |
96 | 96 | } |
97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * {@inheritDoc} |
101 | 101 | * @see \web\lib\admin\domain\storage\StorageInterface::add() |
102 | 102 | */ |
103 | - public function add($identifier, $object){ |
|
103 | + public function add($identifier, $object) { |
|
104 | 104 | $this->session[$identifier][] = $object; |
105 | 105 | } |
106 | 106 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | * {@inheritDoc} |
110 | 110 | * @see \web\lib\admin\domain\storage\StorageInterface::get() |
111 | 111 | */ |
112 | - public function get($identifier){ |
|
113 | - if(isset($this->session[$identifier])){ |
|
112 | + public function get($identifier) { |
|
113 | + if (isset($this->session[$identifier])) { |
|
114 | 114 | return $this->session[$identifier]; |
115 | - }else{ |
|
115 | + } else { |
|
116 | 116 | return array(); |
117 | 117 | } |
118 | 118 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * |
122 | 122 | */ |
123 | - public function getAll(){ |
|
123 | + public function getAll() { |
|
124 | 124 | return $this->session; |
125 | 125 | } |
126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * {@inheritDoc} |
130 | 130 | * @see \web\lib\admin\domain\storage\StorageInterface::delete() |
131 | 131 | */ |
132 | - public function delete($identifier){ |
|
132 | + public function delete($identifier) { |
|
133 | 133 | unset($this->session[$identifier]); |
134 | 134 | } |
135 | 135 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $_SESSION[self::INDEX][self::SCOPED][$package] = array(); |
56 | 56 | } |
57 | 57 | $this->session = &$_SESSION[self::INDEX][self::SCOPED][$package]; |
58 | - }else{ |
|
58 | + } else{ |
|
59 | 59 | $this->session = &$_SESSION[self::INDEX][self::WIDE]; |
60 | 60 | } |
61 | 61 | $this->package = $package; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | self::$instance = new self($package); |
74 | 74 | } |
75 | 75 | return self::$instance; |
76 | - }else{ |
|
76 | + } else{ |
|
77 | 77 | if(!isset(self::$pool[$package])){ |
78 | 78 | self::$pool[$package] = new self($package); |
79 | 79 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function get($identifier){ |
113 | 113 | if(isset($this->session[$identifier])){ |
114 | 114 | return $this->session[$identifier]; |
115 | - }else{ |
|
115 | + } else{ |
|
116 | 116 | return array(); |
117 | 117 | } |
118 | 118 | } |
@@ -16,10 +16,10 @@ |
||
16 | 16 | */ |
17 | 17 | private $box; |
18 | 18 | |
19 | - /** |
|
20 | - * |
|
21 | - * @param string $class |
|
22 | - */ |
|
19 | + /** |
|
20 | + * |
|
21 | + * @param string $class |
|
22 | + */ |
|
23 | 23 | public function __construct($class) { |
24 | 24 | $this->box = new CompositeTag('div'); |
25 | 25 | $this->class = $class; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * {@inheritDoc} |
32 | 32 | * @see \web\lib\admin\view\MessageReceiverInterface::hasMessages() |
33 | 33 | */ |
34 | - public function hasMessages(){ |
|
34 | + public function hasMessages() { |
|
35 | 35 | return $this->box->size() > 0; |
36 | 36 | } |
37 | 37 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * {@inheritDoc} |
42 | 42 | * @see MessageReceiverInterface::receiveMessage() |
43 | 43 | */ |
44 | - public function receiveMessage($message){ |
|
44 | + public function receiveMessage($message) { |
|
45 | 45 | $p = new Tag('p'); |
46 | 46 | $p->addAttribute('class', $message->getClass($this->class)); |
47 | 47 | $p->addText($message->getText()); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * |
53 | 53 | */ |
54 | - public function render(){ |
|
54 | + public function render() { |
|
55 | 55 | echo $this->__toString(); |
56 | 56 | } |
57 | 57 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * {@inheritDoc} |
61 | 61 | * @see HtmlElementInterface::__toString() |
62 | 62 | */ |
63 | - public function __toString(){ |
|
64 | - if($this->hasMessages()){ |
|
63 | + public function __toString() { |
|
64 | + if ($this->hasMessages()) { |
|
65 | 65 | return $this->box->__toString(); |
66 | - }else{ |
|
66 | + } else { |
|
67 | 67 | return ''; |
68 | 68 | } |
69 | 69 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | public function __toString(){ |
64 | 64 | if($this->hasMessages()){ |
65 | 65 | return $this->box->__toString(); |
66 | - }else{ |
|
66 | + } else{ |
|
67 | 67 | return ''; |
68 | 68 | } |
69 | 69 | } |
@@ -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 | } |
@@ -106,7 +106,7 @@ |
||
106 | 106 | |
107 | 107 | } |
108 | 108 | return $innerString; |
109 | - }else{ |
|
109 | + } else{ |
|
110 | 110 | return parent::composeInnerString(); |
111 | 111 | } |
112 | 112 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @author Zilvinas Vaira |
7 | 7 | * |
8 | 8 | */ |
9 | -class Row extends Tag{ |
|
9 | +class Row extends Tag { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param array $cells |
43 | 43 | */ |
44 | - public function setCells($cells){ |
|
44 | + public function setCells($cells) { |
|
45 | 45 | foreach ($cells as $key => $cell) { |
46 | 46 | $td = new CompositeTag('td'); |
47 | 47 | $td->addText($cell); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return number |
55 | 55 | */ |
56 | - public function size(){ |
|
56 | + public function size() { |
|
57 | 57 | return count($this->cells); |
58 | 58 | } |
59 | 59 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return \web\lib\admin\view\html\CompositeTag[] |
63 | 63 | */ |
64 | - public function getCells(){ |
|
64 | + public function getCells() { |
|
65 | 65 | return $this->cells; |
66 | 66 | } |
67 | 67 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @param string $name |
72 | 72 | * @param string $value |
73 | 73 | */ |
74 | - public function addCellAttribute($column, $name, $value){ |
|
75 | - if(isset($this->cells[$column])){ |
|
74 | + public function addCellAttribute($column, $name, $value) { |
|
75 | + if (isset($this->cells[$column])) { |
|
76 | 76 | $this->cells[$column]->addAttribute($name, $value); |
77 | 77 | } |
78 | 78 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @param array $columns |
83 | 83 | */ |
84 | - public function setColumns($columns){ |
|
84 | + public function setColumns($columns) { |
|
85 | 85 | $this->columns = $columns; |
86 | 86 | } |
87 | 87 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * @param string $column |
91 | 91 | * @param UnaryTag $element |
92 | 92 | */ |
93 | - public function addToCell($column, $element){ |
|
94 | - if(!isset($this->cells[$column])){ |
|
93 | + public function addToCell($column, $element) { |
|
94 | + if (!isset($this->cells[$column])) { |
|
95 | 95 | $this->cells[$column] = new CompositeTag('td'); |
96 | 96 | } |
97 | 97 | $this->cells[$column]->addTag($element); |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @param string $column |
103 | 103 | * @return \web\lib\admin\view\html\CompositeTag |
104 | 104 | */ |
105 | - public function getCell($column){ |
|
106 | - if(!isset($this->cells[$column])){ |
|
105 | + public function getCell($column) { |
|
106 | + if (!isset($this->cells[$column])) { |
|
107 | 107 | $this->cells[$column] = new CompositeTag('td'); |
108 | 108 | } |
109 | 109 | return $this->cells[$column]; |
@@ -114,19 +114,19 @@ discard block |
||
114 | 114 | * {@inheritDoc} |
115 | 115 | * @see \web\lib\admin\view\html\Tag::composeInnerString() |
116 | 116 | */ |
117 | - public function composeInnerString(){ |
|
118 | - if(count($this->columns)>0){ |
|
117 | + public function composeInnerString() { |
|
118 | + if (count($this->columns) > 0) { |
|
119 | 119 | $innerString = ""; |
120 | 120 | foreach ($this->columns as $column) { |
121 | - if(!isset($this->cells[$column])){ |
|
121 | + if (!isset($this->cells[$column])) { |
|
122 | 122 | $this->cells[$column] = new CompositeTag('td'); |
123 | 123 | } |
124 | - $this->cells[$column]->setTab("\t".$this->tab); |
|
124 | + $this->cells[$column]->setTab("\t" . $this->tab); |
|
125 | 125 | $innerString .= $this->cells[$column]; |
126 | 126 | |
127 | 127 | } |
128 | 128 | return $innerString; |
129 | - }else{ |
|
129 | + } else { |
|
130 | 130 | return parent::composeInnerString(); |
131 | 131 | } |
132 | 132 | } |
@@ -6,13 +6,13 @@ |
||
6 | 6 | * @author Zilvinas Vaira |
7 | 7 | * |
8 | 8 | */ |
9 | -class Button extends Tag{ |
|
9 | +class Button extends Tag { |
|
10 | 10 | |
11 | 11 | const SUBMIT_TYPE = 'submit'; |
12 | 12 | const RESET_TYPE = 'reset'; |
13 | 13 | const BUTTON_TYPE = 'button'; |
14 | 14 | |
15 | - public function __construct($title, $type = self::SUBMIT_TYPE, $name = '', $value = '', $class = '', $id = ''){ |
|
15 | + public function __construct($title, $type = self::SUBMIT_TYPE, $name = '', $value = '', $class = '', $id = '') { |
|
16 | 16 | parent::__construct('button'); |
17 | 17 | $this->addAttribute('type', $type); |
18 | 18 | $this->addAttribute('name', $name); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return UnaryTag[] |
23 | 23 | */ |
24 | - public function getTags(){ |
|
24 | + public function getTags() { |
|
25 | 25 | return $this->tags; |
26 | 26 | } |
27 | 27 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return number |
31 | 31 | */ |
32 | - public function size(){ |
|
32 | + public function size() { |
|
33 | 33 | return count($this->tags); |
34 | 34 | } |
35 | 35 | |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | * {@inheritDoc} |
39 | 39 | * @see \lib\html\Tag::composeInnerString() |
40 | 40 | */ |
41 | - protected function composeInnerString(){ |
|
41 | + protected function composeInnerString() { |
|
42 | 42 | $innerString = "\n\t" . $this->tab . $this->text; |
43 | 43 | foreach ($this->tags as $tag) { |
44 | - $tag->setTab("\t".$this->tab); |
|
44 | + $tag->setTab("\t" . $this->tab); |
|
45 | 45 | $innerString .= $tag; |
46 | 46 | } |
47 | 47 | return $innerString; |
@@ -65,7 +65,7 @@ |
||
65 | 65 | } |
66 | 66 | if(isset($this->name)){ |
67 | 67 | return $this->composeTagString($attributeString); |
68 | - }else{ |
|
68 | + } else{ |
|
69 | 69 | return ""; |
70 | 70 | } |
71 | 71 | } |
@@ -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,8 +54,8 @@ 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 | 61 | /** |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | * {@inheritDoc} |
64 | 64 | * @see \web\lib\admin\view\html\HtmlElementInterface::__toString() |
65 | 65 | */ |
66 | - public function __toString(){ |
|
66 | + public function __toString() { |
|
67 | 67 | $attributeString = ""; |
68 | 68 | foreach ($this->attributes as $attribute) { |
69 | 69 | $attributeString .= $attribute; |
70 | 70 | } |
71 | - if(isset($this->name)){ |
|
71 | + if (isset($this->name)) { |
|
72 | 72 | return $this->composeTagString($attributeString); |
73 | - }else{ |
|
73 | + } else { |
|
74 | 74 | return ""; |
75 | 75 | } |
76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * {@inheritDoc} |
81 | 81 | * @see \web\lib\admin\view\PageElementInterface::render() |
82 | 82 | */ |
83 | - public function render(){ |
|
83 | + public function render() { |
|
84 | 84 | echo $this->__toString(); |
85 | 85 | } |
86 | 86 |
@@ -3,7 +3,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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> |
@@ -45,9 +45,9 @@ discard block |
||
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 |
||
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 |
||
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'); |