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

Yoast / wordpress-seo / dd6e866a9e6d253114633104d9e3858d807178ba

19 Jun 2024 10:03AM UTC coverage: 48.628% (-4.3%) from 52.936%
dd6e866a9e6d253114633104d9e3858d807178ba

push

github

web-flow
Merge pull request #21431 from Yoast/21429-update-copy-in-the-introduction-and-consent-modals

Updates the copy for the introduction and consent modals

7441 of 13454 branches covered (55.31%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 2 files covered. (0.0%)

3718 existing lines in 107 files now uncovered.

25100 of 53464 relevant lines covered (46.95%)

62392.47 hits per line

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

0.0
/admin/class-asset.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin
6
 */
7

8
/**
9
 * Represents a WPSEO asset
10
 */
11
class WPSEO_Admin_Asset {
12

13
        /**
14
         * Constant used to identify file type as a JS file.
15
         *
16
         * @var string
17
         */
18
        public const TYPE_JS = 'js';
19

20
        /**
21
         * Constant used to identify file type as a CSS file.
22
         *
23
         * @var string
24
         */
25
        public const TYPE_CSS = 'css';
26

27
        /**
28
         * The name option identifier.
29
         *
30
         * @var string
31
         */
32
        public const NAME = 'name';
33

34
        /**
35
         * The source option identifier.
36
         *
37
         * @var string
38
         */
39
        public const SRC = 'src';
40

41
        /**
42
         * The dependencies option identifier.
43
         *
44
         * @var string
45
         */
46
        public const DEPS = 'deps';
47

48
        /**
49
         * The version option identifier.
50
         *
51
         * @var string
52
         */
53
        public const VERSION = 'version';
54

55
        /* Style specific. */
56

57
        /**
58
         * The media option identifier.
59
         *
60
         * @var string
61
         */
62
        public const MEDIA = 'media';
63

64
        /**
65
         * The rtl option identifier.
66
         *
67
         * @var string
68
         */
69
        public const RTL = 'rtl';
70

71
        /* Script specific. */
72

73
        /**
74
         * The "in footer" option identifier.
75
         *
76
         * @var string
77
         */
78
        public const IN_FOOTER = 'in_footer';
79

80
        /**
81
         * Asset identifier.
82
         *
83
         * @var string
84
         */
85
        protected $name;
86

87
        /**
88
         * Path to the asset.
89
         *
90
         * @var string
91
         */
92
        protected $src;
93

94
        /**
95
         * Asset dependencies.
96
         *
97
         * @var string|array
98
         */
99
        protected $deps;
100

101
        /**
102
         * Asset version.
103
         *
104
         * @var string
105
         */
106
        protected $version;
107

108
        /**
109
         * For CSS Assets. The type of media for which this stylesheet has been defined.
110
         *
111
         * See https://www.w3.org/TR/CSS2/media.html#media-types.
112
         *
113
         * @var string
114
         */
115
        protected $media;
116

117
        /**
118
         * For JS Assets. Whether or not the script should be loaded in the footer.
119
         *
120
         * @var bool
121
         */
122
        protected $in_footer;
123

124
        /**
125
         * For CSS Assets. Whether this stylesheet is a right-to-left stylesheet.
126
         *
127
         * @var bool
128
         */
129
        protected $rtl;
130

131
        /**
132
         * File suffix.
133
         *
134
         * @var string
135
         */
136
        protected $suffix;
137

138
        /**
139
         * Default asset arguments.
140
         *
141
         * @var array
142
         */
143
        private $defaults = [
144
                'deps'      => [],
145
                'in_footer' => true,
146
                'rtl'       => true,
147
                'media'     => 'all',
148
                'version'   => '',
149
                'suffix'    => '',
150
        ];
151

152
        /**
153
         * Constructs an instance of the WPSEO_Admin_Asset class.
154
         *
155
         * @param array $args The arguments for this asset.
156
         *
157
         * @throws InvalidArgumentException Throws when no name or src has been provided.
158
         */
UNCOV
159
        public function __construct( array $args ) {
×
UNCOV
160
                if ( ! isset( $args['name'] ) ) {
×
UNCOV
161
                        throw new InvalidArgumentException( 'name is a required argument' );
×
162
                }
163

UNCOV
164
                if ( ! isset( $args['src'] ) ) {
×
UNCOV
165
                        throw new InvalidArgumentException( 'src is a required argument' );
×
166
                }
167

168
                $args = array_merge( $this->defaults, $args );
×
169

170
                $this->name      = $args['name'];
×
171
                $this->src       = $args['src'];
×
172
                $this->deps      = $args['deps'];
×
173
                $this->version   = $args['version'];
×
174
                $this->media     = $args['media'];
×
175
                $this->in_footer = $args['in_footer'];
×
176
                $this->rtl       = $args['rtl'];
×
177
                $this->suffix    = $args['suffix'];
×
178
        }
179

180
        /**
181
         * Returns the asset identifier.
182
         *
183
         * @return string
184
         */
UNCOV
185
        public function get_name() {
×
UNCOV
186
                return $this->name;
×
187
        }
188

189
        /**
190
         * Returns the path to the asset.
191
         *
192
         * @return string
193
         */
UNCOV
194
        public function get_src() {
×
UNCOV
195
                return $this->src;
×
196
        }
197

198
        /**
199
         * Returns the asset dependencies.
200
         *
201
         * @return array|string
202
         */
UNCOV
203
        public function get_deps() {
×
UNCOV
204
                return $this->deps;
×
205
        }
206

207
        /**
208
         * Returns the asset version.
209
         *
210
         * @return string|null
211
         */
UNCOV
212
        public function get_version() {
×
UNCOV
213
                if ( ! empty( $this->version ) ) {
×
UNCOV
214
                        return $this->version;
×
215
                }
216

UNCOV
217
                return null;
×
218
        }
219

220
        /**
221
         * Returns the media type for CSS assets.
222
         *
223
         * @return string
224
         */
UNCOV
225
        public function get_media() {
×
UNCOV
226
                return $this->media;
×
227
        }
228

229
        /**
230
         * Returns whether a script asset should be loaded in the footer of the page.
231
         *
232
         * @return bool
233
         */
UNCOV
234
        public function is_in_footer() {
×
UNCOV
235
                return $this->in_footer;
×
236
        }
237

238
        /**
239
         * Returns whether this CSS has a RTL counterpart.
240
         *
241
         * @return bool
242
         */
UNCOV
243
        public function has_rtl() {
×
UNCOV
244
                return $this->rtl;
×
245
        }
246

247
        /**
248
         * Returns the file suffix.
249
         *
250
         * @return string
251
         */
UNCOV
252
        public function get_suffix() {
×
UNCOV
253
                return $this->suffix;
×
254
        }
255
}
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

© 2025 Coveralls, Inc