Completed
Push — constructionplanless_theConten... ( 4a0b59 )
by Dominik
03:11 queued 01:42
created

timber.php ➔ getTimberDefaultContext()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
nc 6
nop 1
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
1
<?php
2
3
use Timber\Timber;
4
use Timber\Post;
5
use Timber\PostQuery;
6
7
function getTimberDefaultContext($singlePost = false)
8
{
9
    $context = Timber::get_context();
10
    if ($singlePost) {
11
        if (is_numeric($singlePost)) {
12
            $context['post'] = new Post($singlePost);
13
        } else {
14
            $context['post'] = new Post();
15
        }
16
    } else {
17
        $context['posts'] = new PostQuery();
18
    }
19
    $context['feedTitle'] = $context['site']->name . ' ' . __('Feed', 'flynt-starter-theme');
20
    $context['dir'] = is_rtl() ? 'rtl' : 'ltr';
21
22
    return $context;
23
}
24