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

Yoast / duplicate-post / 14725616456

29 Apr 2025 07:21AM UTC coverage: 45.469% (-4.7%) from 50.122%
14725616456

push

github

web-flow
Merge pull request #402 from Yoast/feature/drop-php-7.2-7.3

Drop support for Php 7.2 and 7.3

1164 of 2560 relevant lines covered (45.47%)

1.61 hits per line

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

43.75
/src/admin/options-inputs.php
1
<?php
2

3
namespace Yoast\WP\Duplicate_Post\Admin;
4

5
/**
6
 * Class Options_Inputs.
7
 */
8
class Options_Inputs {
9

10
        /**
11
         * Creates a basic input based on the passed parameters.
12
         *
13
         * @param string $type       The type of input.
14
         * @param string $name       The name of the input.
15
         * @param string $value      The value of the input.
16
         * @param string $id         The ID of the input.
17
         * @param string $attributes The additional attributes to use. Optional.
18
         *
19
         * @return string The input's HTML output.
20
         */
21
        protected function input( $type, $name, $value, $id, $attributes = '' ) {
×
22
                return \sprintf(
×
23
                        '<input type="%s" name="%s" id="%s" value="%s" %s />',
×
24
                        \esc_attr( $type ),
×
25
                        \esc_attr( $name ),
×
26
                        \esc_attr( $id ),
×
27
                        \esc_attr( $value ),
×
28
                        $attributes
×
29
                );
×
30
        }
31

32
        /**
33
         * Creates a checkbox input.
34
         *
35
         * @param string $name    The name of the checkbox.
36
         * @param string $value   The value of the checkbox.
37
         * @param string $id      The ID of the checkbox.
38
         * @param bool   $checked Whether or not the checkbox should be checked.
39
         *
40
         * @return string The checkbox' HTML output.
41
         */
42
        public function checkbox( $name, $value, $id, $checked = false ) {
2✔
43
                $checked = \checked( $checked, true, false );
2✔
44

45
                return $this->input( 'checkbox', $name, $value, $id, $checked );
2✔
46
        }
47

48
        /**
49
         * Creates a text field input.
50
         *
51
         * @param string $name  The name of the text field.
52
         * @param string $value The value of the text field.
53
         * @param string $id    The ID of the text field.
54
         *
55
         * @return string The text field's HTML output.
56
         */
57
        public function text( $name, $value, $id ) {
2✔
58
                return $this->input( 'text', $name, $value, $id );
2✔
59
        }
60

61
        /**
62
         * Creates a number input.
63
         *
64
         * @param string $name  The name of the number input.
65
         * @param string $value The value of the number input.
66
         * @param string $id    The ID of the number input.
67
         *
68
         * @return string The number input's HTML output.
69
         */
70
        public function number( $name, $value, $id ) {
2✔
71
                return $this->input( 'number', $name, $value, $id, 'min="0" step="1"' );
2✔
72
        }
73
}
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