Skip to content

Commit 786fb05

Browse files
committed
Remove duplicate documentation
1 parent 958f297 commit 786fb05

File tree

4 files changed

+35
-55
lines changed

4 files changed

+35
-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: 20 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,57 @@ 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
3845
*/
3946
public function current() {
4047
return $this->messages[$this->position];
4148
}
4249

4350
/**
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
51+
* {@inheritdoc}
4952
*/
5053
public function next() {
5154
++$this->position;
5255
}
5356

5457
/**
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
58+
* {@inheritdoc}
6059
*/
6160
public function key() {
6261
return $this->position;
6362
}
6463

6564
/**
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
65+
* {@inheritdoc}
7266
*/
7367
public function valid() {
7468
return isset($this->messages[$this->position]);
7569
}
7670

7771
/**
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
72+
* {@inheritdoc}
8373
*/
8474
public function rewind() {
8575
$this->position = 0;
8676
}
8777

8878
/**
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
79+
* {@inheritdoc}
10680
*/
10781
public function count() {
10882
return count($this->messages);
10983
}
110-
}
84+
85+
}

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>

modules/checkout/tests/src/Kernel/CompletionMessagesTest.php

Lines changed: 11 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

@@ -19,22 +13,31 @@
1913
class CompletionMessagesTest extends CommerceKernelTestBase {
2014

2115
/**
22-
* @var CompletionMessages
16+
* @var \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CompletionMessages
2317
*/
2418
private $completionMessages;
2519

20+
/**
21+
* {@inheritdoc}
22+
*/
2623
public function setUp() {
2724
parent::setUp();
2825
$this->completionMessages = new CompletionMessages();
2926
}
3027

28+
/**
29+
* Tests add message method.
30+
*/
3131
public function testAddMessage() {
3232
$this->completionMessages->addMessage(t('Message 1'));
3333
$this->completionMessages->addMessage(t('Message 2'));
3434

3535
$this->assertCount(2, $this->completionMessages);
3636
}
3737

38+
/**
39+
* Tests the messages iterator.
40+
*/
3841
public function testMessagesIterator() {
3942
$this->completionMessages->addMessage(t('Message 1'));
4043
$this->completionMessages->addMessage(t('Message 2'));
@@ -44,4 +47,4 @@ public function testMessagesIterator() {
4447
$this->assertEquals('Message 2', $this->completionMessages->current()->render());
4548
}
4649

47-
}
50+
}

0 commit comments

Comments
 (0)