@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @author Zilvinas Vaira |
10 | 10 | * |
11 | 11 | */ |
12 | -class PageElementAdapter implements PageElementInterface{ |
|
12 | +class PageElementAdapter implements PageElementInterface { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Wrapped HTML element. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param string $text |
41 | 41 | */ |
42 | - public function addText($text){ |
|
42 | + public function addText($text) { |
|
43 | 43 | $this->text .= $text; |
44 | 44 | } |
45 | 45 | |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * @see \web\lib\admin\view\PageElementInterface::render() |
50 | 50 | */ |
51 | 51 | public function render() { |
52 | - if($this->element != null){ |
|
52 | + if ($this->element != null) { |
|
53 | 53 | echo $this->element; |
54 | 54 | } |
55 | - if($this->text != ''){ |
|
55 | + if ($this->text != '') { |
|
56 | 56 | echo $this->text; |
57 | 57 | } |
58 | 58 | } |
@@ -8,15 +8,15 @@ discard block |
||
8 | 8 | use web\lib\admin\view\DefaultHtmlPage; |
9 | 9 | use web\lib\admin\view\InstitutionPageBuilder; |
10 | 10 | |
11 | -class MockEmptyPageBuilder extends InstitutionPageBuilder{ |
|
11 | +class MockEmptyPageBuilder extends InstitutionPageBuilder { |
|
12 | 12 | |
13 | - public function __construct($page){ |
|
13 | + public function __construct($page) { |
|
14 | 14 | $this->page = $page; |
15 | 15 | } |
16 | 16 | |
17 | 17 | } |
18 | 18 | |
19 | -class SendTokenByEmailTest extends PHPUnit_Framework_TestCase{ |
|
19 | +class SendTokenByEmailTest extends PHPUnit_Framework_TestCase { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $this->command = new MockSendTokenByEmail(MockSendTokenByEmail::COMMAND, $context); |
37 | 37 | } |
38 | 38 | |
39 | - public function testExecute(){ |
|
39 | + public function testExecute() { |
|
40 | 40 | |
41 | 41 | $this->command->execute(); |
42 | 42 | $mail = $this->command->getMailer(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $this->command->execute(); |
51 | 51 | $this->assertEmpty($mail->ErrorInfo); |
52 | 52 | $this->assertNotEquals("", $mail->Subject); |
53 | - $this->assertTrue(strpos($mail->Body, $_POST[GetTokenEmailDetails::PARAM_TOKENLINK])!==false); |
|
53 | + $this->assertTrue(strpos($mail->Body, $_POST[GetTokenEmailDetails::PARAM_TOKENLINK]) !== false); |
|
54 | 54 | $this->assertNotEmpty($mail->getAllRecipientAddresses()); |
55 | 55 | $this->assertArrayHasKey($_POST[ValidateEmailAddress::PARAM_ADDRESS], $mail->getAllRecipientAddresses()); |
56 | 56 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))) . "/core/PHPMailer/src/PHPMailer.php"); |
3 | 3 | use PHPMailer\PHPMailer\PHPMailer; |
4 | 4 | |
5 | -class MockPHPMailer extends PHPMailer{ |
|
5 | +class MockPHPMailer extends PHPMailer { |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | * {@inheritDoc} |
17 | 17 | * @see \PHPMailer\PHPMailer\PHPMailer::send() |
18 | 18 | */ |
19 | - public function send(){ |
|
20 | - if($this->Subject && $this->Body && count($this->to)>0){ |
|
19 | + public function send() { |
|
20 | + if ($this->Subject && $this->Body && count($this->to) > 0) { |
|
21 | 21 | return true; |
22 | - }else{ |
|
22 | + } else { |
|
23 | 23 | $this->ErrorInfo = "Missing subject, body or email address!"; |
24 | 24 | return false; |
25 | 25 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function send(){ |
20 | 20 | if($this->Subject && $this->Body && count($this->to)>0){ |
21 | 21 | return true; |
22 | - }else{ |
|
22 | + } else{ |
|
23 | 23 | $this->ErrorInfo = "Missing subject, body or email address!"; |
24 | 24 | return false; |
25 | 25 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use web\lib\admin\view\DefaultAjaxPage; |
4 | 4 | use web\lib\admin\view\html\CompositeTag; |
5 | 5 | |
6 | -class MockDefaultAjaxPage extends DefaultAjaxPage{ |
|
6 | +class MockDefaultAjaxPage extends DefaultAjaxPage { |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * {@inheritDoc} |
24 | 24 | * @see \web\lib\admin\view\AbstractPage::appendHtmlElement() |
25 | 25 | */ |
26 | - public function appendHtmlElement($name, $element){ |
|
27 | - if($name==DefaultAjaxPage::SECTION_RESPONSE){ |
|
26 | + public function appendHtmlElement($name, $element) { |
|
27 | + if ($name == DefaultAjaxPage::SECTION_RESPONSE) { |
|
28 | 28 | $this->response->addTag($element); |
29 | 29 | } |
30 | 30 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return CompositeTag |
35 | 35 | */ |
36 | - public function getResponse(){ |
|
36 | + public function getResponse() { |
|
37 | 37 | return $this->response; |
38 | 38 | } |
39 | 39 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use web\lib\admin\http\DefaultContext; |
6 | 6 | use web\lib\admin\http\GetTokenEmailDetails; |
7 | 7 | |
8 | -class GetTokenEmailDetailsTest extends PHPUnit_Framework_TestCase{ |
|
8 | +class GetTokenEmailDetailsTest extends PHPUnit_Framework_TestCase { |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | $this->command = new GetTokenEmailDetails(GetTokenEmailDetails::COMMAND, new DefaultContext($this->page)); |
25 | 25 | } |
26 | 26 | |
27 | - public function testExecute(){ |
|
27 | + public function testExecute() { |
|
28 | 28 | |
29 | 29 | $this->command->execute(); |
30 | 30 | $response = $this->page->getResponse(); |
31 | 31 | $renderedResponse = $response->__toString(); |
32 | - $this->assertTrue(strpos($renderedResponse, '<response>')!==false); |
|
33 | - $this->assertTrue(strpos($renderedResponse, '</response>')!==false); |
|
32 | + $this->assertTrue(strpos($renderedResponse, '<response>') !== false); |
|
33 | + $this->assertTrue(strpos($renderedResponse, '</response>') !== false); |
|
34 | 34 | $this->assertFalse(strpos($renderedResponse, 'subject=')); |
35 | 35 | |
36 | 36 | $_POST[GetTokenEmailDetails::PARAM_TOKENLINK] = 'testtokenlinkstring'; |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | $renderedResponse = $response->__toString(); |
41 | 41 | |
42 | - $this->assertTrue(strpos($renderedResponse, '<response>')!==false); |
|
43 | - $this->assertTrue(strpos($renderedResponse, '</response>')!==false); |
|
44 | - $this->assertTrue(strpos($renderedResponse, 'subject=')!==false); |
|
45 | - $this->assertTrue(strpos($renderedResponse, $_POST[GetTokenEmailDetails::PARAM_TOKENLINK])!==false); |
|
42 | + $this->assertTrue(strpos($renderedResponse, '<response>') !== false); |
|
43 | + $this->assertTrue(strpos($renderedResponse, '</response>') !== false); |
|
44 | + $this->assertTrue(strpos($renderedResponse, 'subject=') !== false); |
|
45 | + $this->assertTrue(strpos($renderedResponse, $_POST[GetTokenEmailDetails::PARAM_TOKENLINK]) !== false); |
|
46 | 46 | } |
47 | 47 | } |
@@ -4,14 +4,14 @@ discard block |
||
4 | 4 | use web\lib\admin\http\SilverbulletContext; |
5 | 5 | use web\lib\admin\http\GetTokenEmailDetails; |
6 | 6 | |
7 | -class MockSendTokenByEmail extends SendTokenByEmail{ |
|
7 | +class MockSendTokenByEmail extends SendTokenByEmail { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * |
11 | 11 | * @param string $commandToken |
12 | 12 | * @param SilverbulletContext $context |
13 | 13 | */ |
14 | - public function __construct($commandToken, $context){ |
|
14 | + public function __construct($commandToken, $context) { |
|
15 | 15 | $this->session = $context->getSession(); |
16 | 16 | $this->mail = new MockPHPMailer(); |
17 | 17 | $this->detailsCommand = new GetTokenEmailDetails(GetTokenEmailDetails::COMMAND, $context); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return \PHPMailer\PHPMailer\PHPMailer |
24 | 24 | */ |
25 | - public function getMailer(){ |
|
25 | + public function getMailer() { |
|
26 | 26 | return $this->mail; |
27 | 27 | } |
28 | 28 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @author Zilvinas Vaira |
10 | 10 | * |
11 | 11 | */ |
12 | -class UpdateUserCommand extends AbstractInvokerCommand{ |
|
12 | +class UpdateUserCommand extends AbstractInvokerCommand { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Update command identifier. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string $commandToken |
30 | 30 | * @param SilverbulletContext $context |
31 | 31 | */ |
32 | - public function __construct($commandToken, $context){ |
|
32 | + public function __construct($commandToken, $context) { |
|
33 | 33 | parent::__construct($commandToken, $context); |
34 | 34 | $this->context = $context; |
35 | 35 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * {@inheritDoc} |
40 | 40 | * @see \web\lib\admin\http\AbstractCommand::execute() |
41 | 41 | */ |
42 | - public function execute(){ |
|
42 | + public function execute() { |
|
43 | 43 | $userIndex = $this->parseInt($_POST[self::COMMAND]); |
44 | 44 | $userIds = $this->parseArray($_POST[SaveUsersCommand::PARAM_ID]); |
45 | 45 | $userExpiries = $this->parseArray($_POST[SaveUsersCommand::PARAM_EXPIRY]); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $user->setExpiry($userExpiry); |
53 | 53 | $username = $user->getUsername(); |
54 | - if(empty($user->get(SilverbulletUser::EXPIRY))){ |
|
54 | + if (empty($user->get(SilverbulletUser::EXPIRY))) { |
|
55 | 55 | $this->storeErrorMessage(sprintf(_("Expiry date was incorrect for '%s'!"), $username)); |
56 | 56 | } |
57 | 57 | $user->save(); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Zilvinas Vaira |
9 | 9 | * |
10 | 10 | */ |
11 | -class RevokeCertificateCommand extends AbstractInvokerCommand{ |
|
11 | +class RevokeCertificateCommand extends AbstractInvokerCommand { |
|
12 | 12 | |
13 | 13 | const COMMAND = 'revokecertificate'; |
14 | 14 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param string $commandToken |
24 | 24 | * @param SilverbulletContext $context |
25 | 25 | */ |
26 | - public function __construct($commandToken, $context){ |
|
26 | + public function __construct($commandToken, $context) { |
|
27 | 27 | parent::__construct($commandToken, $context); |
28 | 28 | $this->context = $context; |
29 | 29 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * {@inheritDoc} |
34 | 34 | * @see \web\lib\admin\http\AbstractCommand::execute() |
35 | 35 | */ |
36 | - public function execute(){ |
|
36 | + public function execute() { |
|
37 | 37 | $profile = $this->context->getProfile(); |
38 | 38 | $certificateId = $this->parseInt($_POST[self::COMMAND]); |
39 | 39 |
@@ -23,8 +23,8 @@ |
||
23 | 23 | * @param string $commandToken |
24 | 24 | * @return AbstractCommand |
25 | 25 | */ |
26 | - public function createCommand($commandToken){ |
|
27 | - if(!isset($this->commands[$commandToken]) || $this->commands[$commandToken] == null){ |
|
26 | + public function createCommand($commandToken) { |
|
27 | + if (!isset($this->commands[$commandToken]) || $this->commands[$commandToken] == null) { |
|
28 | 28 | $this->commands[$commandToken] = $this->doCreateCommand($commandToken); |
29 | 29 | } |
30 | 30 | return $this->commands[$commandToken]; |