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

Yoast / wordpress-seo / 8218b111533b92ec47f94130a94bcd0102263a45

01 Dec 2025 09:48AM UTC coverage: 53.092%. First build
8218b111533b92ec47f94130a94bcd0102263a45

push

github

web-flow
Merge pull request #22759 from Yoast/feature/task-list

Feature/task list

8697 of 16050 branches covered (54.19%)

Branch coverage included in aggregate %.

98 of 605 new or added lines in 51 files covered. (16.2%)

32413 of 61381 relevant lines covered (52.81%)

46976.02 hits per line

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

0.0
/src/task-list/domain/components/call-to-action-entry.php
1
<?php
2
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
namespace Yoast\WP\SEO\Task_List\Domain\Components;
4

5
use InvalidArgumentException;
6
/**
7
 * This class describes a Call To Action Entry.
8
 */
9
class Call_To_Action_Entry {
10

11
        /**
12
         * Allowed types for the call to action.
13
         *
14
         * @var string[]
15
         */
16
        private const ALLOWED_TYPES = [
17
                'default',
18
                'link',
19
                'add',
20
                'delete',
21
        ];
22

23
        /**
24
         * The label of the call to action.
25
         *
26
         * @var string
27
         */
28
        private $label;
29

30
        /**
31
         * The type of the call to action.
32
         *
33
         * @var string
34
         */
35
        private $type;
36

37
        /**
38
         * The href of the call to action.
39
         *
40
         * @var string
41
         */
42
        private $href;
43

44
        /**
45
         * The constructor.
46
         *
47
         * @param string $label The label of the content type entry.
48
         * @param string $type  The type of the content type entry.
49
         * @param string $href  The href of the content type entry.
50
         *
51
         * @throws InvalidArgumentException If the type is invalid.
52
         */
NEW
53
        public function __construct(
×
54
                string $label,
55
                string $type,
56
                ?string $href = null
57
        ) {
NEW
58
                if ( ! \in_array( $type, self::ALLOWED_TYPES, true ) ) {
×
NEW
59
                        throw new InvalidArgumentException( 'Invalid type for call to action' );
×
60
                }
61

NEW
62
                $this->label = $label;
×
NEW
63
                $this->type  = $type;
×
NEW
64
                $this->href  = $href;
×
65
        }
66

67
        /**
68
         * Returns an array representation of the call to action data.
69
         *
70
         * @return array<string, string|bool> Returns in an array format.
71
         */
NEW
72
        public function to_array(): array {
×
NEW
73
                return [
×
NEW
74
                        'label' => $this->label,
×
NEW
75
                        'type'  => $this->type,
×
NEW
76
                        'href'  => $this->href,
×
NEW
77
                ];
×
78
        }
79
}
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