« blib/lib/Bootylicious/Theme/WordpressTwentyten.pm
↑ Summary
blib/lib/Bootylicious/PingbackIterator.pm »
| 1 | package Bootylicious::Plugin::Model; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 1 | ▶ | use base 'Mojolicious::Plugin'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | use Mojolicious::Controller; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 1 | ▶ | use Bootylicious::Article; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 1 | ▶ | use Bootylicious::ArticleArchive; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 1 | ▶ | use Bootylicious::ArticleArchiveSimple; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | 1 | ▶ | use Bootylicious::ArticleByTagIterator; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | 1 | ▶ | use Bootylicious::ArticleByQueryIterator; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | 1 | ▶ | use Bootylicious::ArticleIteratorFinder; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | 1 | ▶ | use Bootylicious::ArticlePager; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | 1 | ▶ | use Bootylicious::Draft; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 1 | ▶ | use Bootylicious::DraftIteratorLoader; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 1 | ▶ | use Bootylicious::DraftIteratorFinder; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | 1 | ▶ | use Bootylicious::IteratorSearchable; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 1 | ▶ | use Bootylicious::Page; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 1 | ▶ | use Bootylicious::PageIteratorLoader; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 23 | 1 | ▶ | use Bootylicious::PageIteratorFinder; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 24 | 1 | ▶ | use Bootylicious::TagCloud; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 25 | 1 | ▶ | use Bootylicious::ArticleIteratorLoader; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 26 | 1 | ▶ | use Bootylicious::CommentIteratorLoader; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | |||||||||||||
| 28 | sub register { | ||||||||||||
| 29 | 1 | ▶ | my ($self, $app) = @_; | ||||||||||
|
Subroutine
register: called CC=1 SCAR=5.8
Pod
documented
| |||||||||||||
| 30 | |||||||||||||
| 31 | 1 | my $c = Mojolicious::Controller->new(app => $app); | |||||||||||
| 32 | |||||||||||||
| 33 | 1 | my $config = $c->config; | |||||||||||
| 34 | |||||||||||||
| 35 | 1 | my $articles_root = $c->articles_root; | |||||||||||
| 36 | 0 | my $pages_root = $c->pages_root; | |||||||||||
| 37 | 0 | my $drafts_root = $c->drafts_root; | |||||||||||
| 38 | |||||||||||||
| 39 | 0 | my $page_limit = $config->{pagelimit}; | |||||||||||
| 40 | |||||||||||||
| 41 | $app->helper( | ||||||||||||
| 42 | get_pager => sub { | ||||||||||||
| 43 | 0 | ▶ | shift; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 44 | 0 | my $iterator = shift; | |||||||||||
| 45 | 0 | Bootylicious::ArticlePager->new( | |||||||||||
| 46 | limit => $page_limit, | ||||||||||||
| 47 | iterator => $iterator, | ||||||||||||
| 48 | @_ | ||||||||||||
| 49 | ); | ||||||||||||
| 50 | } | ||||||||||||
| 51 | 0 | ); | |||||||||||
| 52 | |||||||||||||
| 53 | $app->helper( | ||||||||||||
| 54 | get_articles => sub { | ||||||||||||
| 55 | 0 | ▶ | shift; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 56 | |||||||||||||
| 57 | 0 | Bootylicious::ArticlePager->new( | |||||||||||
| 58 | iterator => Bootylicious::ArticleIteratorLoader->new( | ||||||||||||
| 59 | root => $articles_root | ||||||||||||
| 60 | )->load, | ||||||||||||
| 61 | limit => $page_limit, | ||||||||||||
| 62 | @_ | ||||||||||||
| 63 | ); | ||||||||||||
| 64 | } | ||||||||||||
| 65 | 0 | ); | |||||||||||
| 66 | |||||||||||||
| 67 | $app->helper( | ||||||||||||
| 68 | get_recent_articles => sub { | ||||||||||||
| 69 | 0 | ▶ | my ($self, $limit) = @_; | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 70 | |||||||||||||
| 71 | 0 | ▶ | return Bootylicious::ArticleIteratorLoader->new( | ||||||||||
|
Condition0%0/2
$limit || 5
MC/DC0%0/1
$limit || 5
$limit
Truth table0%0/2
A
A= $limit
| |||||||||||||
| 72 | root => $articles_root)->load->next($limit || 5); | ||||||||||||
| 73 | } | ||||||||||||
| 74 | 0 | ); | |||||||||||
| 75 | |||||||||||||
| 76 | $app->helper( | ||||||||||||
| 77 | get_recent_comments => sub { | ||||||||||||
| 78 | 0 | ▶ | my ($self, $limit) = @_; | ||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||
| 79 | 0 | ▶ | Bootylicious::CommentIteratorLoader->new(root => $articles_root) | ||||||||||
|
Condition0%0/2
$limit || 5
MC/DC0%0/1
$limit || 5
$limit
Truth table0%0/2
A
A= $limit
| |||||||||||||
| 80 | ->load->reverse->next($limit || 5); | ||||||||||||
| 81 | } | ||||||||||||
| 82 | 0 | ); | |||||||||||
| 83 | |||||||||||||
| 84 | $app->helper( | ||||||||||||
| 85 | get_archive => sub { | ||||||||||||
| 86 | 0 | ▶ | shift; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 87 | 0 | Bootylicious::ArticleArchive->new( | |||||||||||
| 88 | articles => Bootylicious::ArticleIteratorLoader->new( | ||||||||||||
| 89 | root => $articles_root | ||||||||||||
| 90 | )->load, | ||||||||||||
| 91 | @_ | ||||||||||||
| 92 | ); | ||||||||||||
| 93 | } | ||||||||||||
| 94 | 0 | ); | |||||||||||
| 95 | |||||||||||||
| 96 | $app->helper( | ||||||||||||
| 97 | get_archive_simple => sub { | ||||||||||||
| 98 | 0 | ▶ | Bootylicious::ArticleArchiveSimple->new( | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 99 | articles => Bootylicious::ArticleIteratorLoader->new( | ||||||||||||
| 100 | root => $articles_root | ||||||||||||
| 101 | )->load, | ||||||||||||
| 102 | ); | ||||||||||||
| 103 | } | ||||||||||||
| 104 | 0 | ); | |||||||||||
| 105 | |||||||||||||
| 106 | $app->helper( | ||||||||||||
| 107 | get_articles_by_tag => sub { | ||||||||||||
| 108 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 109 | 0 | my $tag = shift; | |||||||||||
| 110 | |||||||||||||
| 111 | 0 | Bootylicious::ArticlePager->new( | |||||||||||
| 112 | iterator => Bootylicious::ArticleByTagIterator->new( | ||||||||||||
| 113 | Bootylicious::ArticleIteratorLoader->new( | ||||||||||||
| 114 | root => $articles_root | ||||||||||||
| 115 | )->load, | ||||||||||||
| 116 | tag => $tag | ||||||||||||
| 117 | ), | ||||||||||||
| 118 | limit => $page_limit, | ||||||||||||
| 119 | @_ | ||||||||||||
| 120 | ); | ||||||||||||
| 121 | } | ||||||||||||
| 122 | 0 | ); | |||||||||||
| 123 | |||||||||||||
| 124 | $app->helper( | ||||||||||||
| 125 | get_articles_by_query => sub { | ||||||||||||
| 126 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 127 | 0 | my $query = shift; | |||||||||||
| 128 | |||||||||||||
| 129 | 0 | return Bootylicious::ArticleByQueryIterator->new( | |||||||||||
| 130 | Bootylicious::ArticleIteratorLoader->new( | ||||||||||||
| 131 | root => $articles_root | ||||||||||||
| 132 | )->load, | ||||||||||||
| 133 | query => $query | ||||||||||||
| 134 | ); | ||||||||||||
| 135 | } | ||||||||||||
| 136 | 0 | ); | |||||||||||
| 137 | |||||||||||||
| 138 | $app->helper( | ||||||||||||
| 139 | get_tag_cloud => sub { | ||||||||||||
| 140 | 0 | ▶ | Bootylicious::TagCloud->new( | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 141 | articles => Bootylicious::ArticleIteratorLoader->new( | ||||||||||||
| 142 | root => $articles_root | ||||||||||||
| 143 | )->load | ||||||||||||
| 144 | ); | ||||||||||||
| 145 | } | ||||||||||||
| 146 | 0 | ); | |||||||||||
| 147 | |||||||||||||
| 148 | $app->helper( | ||||||||||||
| 149 | get_tags => sub { | ||||||||||||
| 150 | 0 | ▶ | Bootylicious::TagCloud->new( | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 151 | articles => Bootylicious::ArticleIteratorLoader->new( | ||||||||||||
| 152 | root => $articles_root | ||||||||||||
| 153 | )->load | ||||||||||||
| 154 | ); | ||||||||||||
| 155 | } | ||||||||||||
| 156 | 0 | ); | |||||||||||
| 157 | |||||||||||||
| 158 | $app->helper( | ||||||||||||
| 159 | get_article => sub { | ||||||||||||
| 160 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 161 | 0 | Bootylicious::ArticleIteratorFinder->new( | |||||||||||
| 162 | iterator => Bootylicious::ArticleIteratorLoader->new( | ||||||||||||
| 163 | root => $articles_root | ||||||||||||
| 164 | )->load | ||||||||||||
| 165 | )->find(@_); | ||||||||||||
| 166 | } | ||||||||||||
| 167 | 0 | ); | |||||||||||
| 168 | |||||||||||||
| 169 | $app->helper( | ||||||||||||
| 170 | get_page => sub { | ||||||||||||
| 171 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 172 | 0 | my $name = shift; | |||||||||||
| 173 | 0 | Bootylicious::PageIteratorFinder->new(iterator => | |||||||||||
| 174 | Bootylicious::PageIteratorLoader->new(root => $pages_root) | ||||||||||||
| 175 | ->load)->find($name); | ||||||||||||
| 176 | } | ||||||||||||
| 177 | 0 | ); | |||||||||||
| 178 | |||||||||||||
| 179 | $app->helper( | ||||||||||||
| 180 | get_draft => sub { | ||||||||||||
| 181 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 182 | 0 | my $name = shift; | |||||||||||
| 183 | |||||||||||||
| 184 | 0 | Bootylicious::DraftIteratorFinder->new( | |||||||||||
| 185 | iterator => Bootylicious::DraftIteratorLoader->new( | ||||||||||||
| 186 | root => $self->drafts_root | ||||||||||||
| 187 | )->load, | ||||||||||||
| 188 | )->find($name); | ||||||||||||
| 189 | } | ||||||||||||
| 190 | 0 | ); | |||||||||||
| 191 | } | ||||||||||||
| 192 | |||||||||||||
| 193 | 1 | 1; | |||||||||||