• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / whip / 6985375056

24 Nov 2023 10:53PM UTC coverage: 28.713% (+1.2%) from 27.5%
6985375056

push

github

web-flow
Merge pull request #152 from Yoast/JRF/ghactions-switch-to-coveralls-reporter

GH Actions: switch to Coveralls action runner to upload reports

87 of 303 relevant lines covered (28.71%)

2.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.0
/src/messages/Whip_BasicMessage.php
1
<?php
2
/**
3
 * WHIP libary file.
4
 *
5
 * @package Yoast\WHIP
6
 */
7

8
/**
9
 * Class Whip_Message.
10
 */
11
class Whip_BasicMessage implements Whip_Message {
12

13
        /**
14
         * Message body.
15
         *
16
         * @var string
17
         */
18
        private $body;
19

20
        /**
21
         * Whip_Message constructor.
22
         *
23
         * @param string $body Message body.
24
         */
25
        public function __construct( $body ) {
×
26
                $this->validateParameters( $body );
×
27

28
                $this->body = $body;
×
29
        }
30

31
        /**
32
         * Retrieves the message body.
33
         *
34
         * @return string Message.
35
         */
36
        public function body() {
3✔
37
                return $this->body;
3✔
38
        }
39

40
        /**
41
         * Validates the parameters passed to the constructor of this class.
42
         *
43
         * @param string $body Message body.
44
         *
45
         * @return void
46
         *
47
         * @throws Whip_EmptyProperty When the $body parameter is empty.
48
         * @throws Whip_InvalidType   When the $body parameter is not of the expected type.
49
         */
50
        private function validateParameters( $body ) {
6✔
51
                if ( empty( $body ) ) {
6✔
52
                        throw new Whip_EmptyProperty( 'Message body' );
3✔
53
                }
54

55
                if ( ! is_string( $body ) ) {
3✔
56
                        throw new Whip_InvalidType( 'Message body', $body, 'string' );
3✔
57
                }
58
        }
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc