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

timber / timber / 5690057835

pending completion
5690057835

push

github

nlemoine
Merge branch '2.x' of github.com:timber/timber into 2.x-refactor-file-models

# Conflicts:
#	src/Attachment.php
#	src/ExternalImage.php
#	src/FileSize.php
#	src/URLHelper.php

1134 of 1134 new or added lines in 55 files covered. (100.0%)

3923 of 4430 relevant lines covered (88.56%)

59.08 hits per line

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

88.89
/src/PostType.php
1
<?php
2

3
namespace Timber;
4

5
use AllowDynamicProperties;
6

7
/**
8
 * Wrapper for the post_type object provided by WordPress
9
 * @since 1.0.4
10
*/
11
#[AllowDynamicProperties]
12
class PostType
13
{
14
    /**
15
     * @var string
16
     */
17
    private $slug;
18

19
    /**
20
     * @param string $post_type
21
     */
22
    public function __construct($post_type)
23
    {
24
        $this->slug = $post_type;
4✔
25
        $this->init($post_type);
4✔
26
    }
27

28
    public function __toString()
29
    {
30
        return $this->slug;
2✔
31
    }
32

33
    protected function init($post_type)
34
    {
35
        $obj = \get_post_type_object($post_type);
4✔
36
        if (!empty($obj)) {
4✔
37
            foreach (\get_object_vars($obj) as $key => $value) {
3✔
38
                if ($key === '' || \ord($key[0]) === 0) {
3✔
39
                    continue;
×
40
                }
41
                $this->$key = $value;
3✔
42
            }
43
        }
44
    }
45
}
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