Skip to content

Commit 102f6a1

Browse files
committed
Remove duplicate documentation
1 parent 958f297 commit 102f6a1

File tree

4 files changed

+38
-55
lines changed

4 files changed

+38
-55
lines changed

modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessage.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane;
44

5+
use Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowInterface;
6+
use Drupal\Core\Entity\EntityTypeManagerInterface;
57
use Drupal\Core\Form\FormStateInterface;
68

79
/**
@@ -23,7 +25,7 @@ class CompletionMessage extends CheckoutPaneBase {
2325
/**
2426
* {@inheritdoc}
2527
*/
26-
public function __construct(array $configuration, $plugin_id, $plugin_definition, \Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowInterface $checkout_flow, \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager) {
28+
public function __construct(array $configuration, $plugin_id, $plugin_definition, CheckoutFlowInterface $checkout_flow, EntityTypeManagerInterface $entity_type_manager) {
2729
parent::__construct($configuration, $plugin_id, $plugin_definition, $checkout_flow, $entity_type_manager);
2830
$this->completionMessags = new CompletionMessages();
2931
}

modules/checkout/src/Plugin/Commerce/CheckoutPane/CompletionMessages.php

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane;
44

55
use Drupal\Core\StringTranslation\TranslatableMarkup;
6-
use Drupal\Core\TypedData\TranslatableInterface;
76

87
/**
98
* Acts as a container to collect all completion messages.
@@ -13,7 +12,7 @@
1312
class CompletionMessages implements \Iterator, \Countable {
1413

1514
/**
16-
* @var \Drupal\Core\TypedData\TranslatableInterface[]
15+
* @var \Drupal\Core\StringTranslation\TranslatableMarkup[]
1716
*/
1817
private $messages;
1918

@@ -30,81 +29,58 @@ public function __construct() {
3029
}
3130

3231
/**
33-
* Return the current element
32+
* Adds a message to the array.
33+
*
34+
* @param \Drupal\Core\StringTranslation\TranslatableMarkup $message
35+
* The message to add.
36+
*/
37+
public function addMessage(TranslatableMarkup $message) {
38+
$this->messages[] = $message;
39+
}
40+
41+
/**
42+
* Gets the current message.
3443
*
35-
* @link http://php.net/manual/en/iterator.current.php
36-
* @return mixed Can return any type.
37-
* @since 5.0.0
44+
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
45+
* The current message.
3846
*/
3947
public function current() {
4048
return $this->messages[$this->position];
4149
}
4250

4351
/**
44-
* Move forward to next element
45-
*
46-
* @link http://php.net/manual/en/iterator.next.php
47-
* @return void Any returned value is ignored.
48-
* @since 5.0.0
52+
* {@inheritdoc}
4953
*/
5054
public function next() {
5155
++$this->position;
5256
}
5357

5458
/**
55-
* Return the key of the current element
56-
*
57-
* @link http://php.net/manual/en/iterator.key.php
58-
* @return mixed scalar on success, or null on failure.
59-
* @since 5.0.0
59+
* {@inheritdoc}
6060
*/
6161
public function key() {
6262
return $this->position;
6363
}
6464

6565
/**
66-
* Checks if current position is valid
67-
*
68-
* @link http://php.net/manual/en/iterator.valid.php
69-
* @return boolean The return value will be casted to boolean and then
70-
* evaluated. Returns true on success or false on failure.
71-
* @since 5.0.0
66+
* {@inheritdoc}
7267
*/
7368
public function valid() {
7469
return isset($this->messages[$this->position]);
7570
}
7671

7772
/**
78-
* Rewind the Iterator to the first element
79-
*
80-
* @link http://php.net/manual/en/iterator.rewind.php
81-
* @return void Any returned value is ignored.
82-
* @since 5.0.0
73+
* {@inheritdoc}
8374
*/
8475
public function rewind() {
8576
$this->position = 0;
8677
}
8778

8879
/**
89-
* Adds a message to the array.
90-
*
91-
* @param \Drupal\Core\StringTranslation\TranslatableMarkup $message
92-
*/
93-
public function addMessage(TranslatableMarkup $message) {
94-
$this->messages[] = $message;
95-
}
96-
97-
/**
98-
* Count elements of an object
99-
*
100-
* @link http://php.net/manual/en/countable.count.php
101-
* @return int The custom count as an integer.
102-
* </p>
103-
* <p>
104-
* The return value is cast to an integer.
105-
* @since 5.1.0
80+
* {@inheritdoc}
10681
*/
10782
public function count() {
10883
return count($this->messages);
10984
}
110-
}
85+
86+
}

modules/checkout/templates/commerce-checkout-completion-message.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#}
1313
<div class="checkout-complete">
1414
{% for message in completion_messages %}
15-
{{ message }}
15+
{{ message }} <br/>
1616
{% endfor %}
1717

1818
{{ 'Your order number is @number.'|t({'@number': order_entity.getOrderNumber}) }} <br>
Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
<?php
2-
/**
3-
* Created by PhpStorm.
4-
* User: robharings
5-
* Date: 09/09/2017
6-
* Time: 13:31
7-
*/
82

93
namespace Drupal\Tests\commerce_checkout\Kernel;
104

@@ -15,26 +9,37 @@
159
* Tests the completion messages class.
1610
*
1711
* @covers \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CompletionMessages
12+
*
13+
* @group commerce
1814
*/
1915
class CompletionMessagesTest extends CommerceKernelTestBase {
2016

2117
/**
22-
* @var CompletionMessages
18+
* @var \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CompletionMessages
2319
*/
2420
private $completionMessages;
2521

22+
/**
23+
* {@inheritdoc}
24+
*/
2625
public function setUp() {
2726
parent::setUp();
2827
$this->completionMessages = new CompletionMessages();
2928
}
3029

30+
/**
31+
* Tests add message method.
32+
*/
3133
public function testAddMessage() {
3234
$this->completionMessages->addMessage(t('Message 1'));
3335
$this->completionMessages->addMessage(t('Message 2'));
3436

3537
$this->assertCount(2, $this->completionMessages);
3638
}
3739

40+
/**
41+
* Tests the messages iterator.
42+
*/
3843
public function testMessagesIterator() {
3944
$this->completionMessages->addMessage(t('Message 1'));
4045
$this->completionMessages->addMessage(t('Message 2'));
@@ -44,4 +49,4 @@ public function testMessagesIterator() {
4449
$this->assertEquals('Message 2', $this->completionMessages->current()->render());
4550
}
4651

47-
}
52+
}

0 commit comments

Comments
 (0)