lib/Tweet/ToDelicious/Entity/OnTweet.pm

filter: Statementstmt 97.4% 38 / 39 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 0.0% 0 / 4 totaltotal 89.4% 51 / 57 CC 4 SCAR 5.3
CC
4
Cov
98%
posts
3.0
screen_name
2.0
tags
2.0
CRAP 1.7
« lib/Tweet/ToDelicious/Entity/Interface.pm ↑ Summary lib/Tweet/ToDelicious/Entity.pm »
1 package Tweet::ToDelicious::Entity::OnTweet;
2  
3 15 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use parent 'Tweet::ToDelicious::Entity::Interface';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 15 ▶use List::MoreUtils qw(uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use Log::Minimal;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 ▶use Class::Accessor::Lite (
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 new => 1,
10 ro => [qw(text in_reply_to_screen_name)],
11 15 );
12  
13 0 ▶sub screen_name { $_[0]->{user}->{screen_name} }
Subroutine screen_name: not called CC=1 SCAR=6.9
Pod undocumented
14  
15 4 ▶sub urls {
Subroutine urls: called CC=1 SCAR=0.0
Pod undocumented
16 4 my $self = shift;
17 4 state @urls;
18 4 @urls = uniq( map $_->{expanded_url}, @{ $self->{entities}->{urls} } );
19 4 return @urls;
20 }
21  
22 4 ▶sub tags {
Subroutine tags: called CC=2 SCAR=6.9
Pod undocumented
23 4 my $self = shift;
24 4 my @tags = map $_->{text}, @{ $self->{entities}->{hashtags} };
25 4 my $text = $self->text;
26 4 my (@from_text) = $text =~ m/\[([^\]]+?)\]/g;
27 4 ▶ return uniq( @tags, @from_text, $self->{favorited} ? 'favorite' : () );
Branch: 1 branch
BranchTrueFalseTotal
$self->{'favorited'} ? : 1 3 4
28 }
29  
30 3 ▶sub posts {
Subroutine posts: called CC=3 SCAR=11.0
Pod undocumented
31 3 my $self = shift;
32 3 my @urls = $self->urls;
33 3 my @posts;
34 3 ▶ if ( @urls > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@urls > 0) 2 1 3
35 2 my $tags = join ',', $self->tags, 'via:tweet2delicious';
36 2 my $text = $self->text;
37 2 for my $url (@urls) {
38 4 push @posts,
39 {
40 url => $url,
41 tags => $tags,
42 description => $text,
43 replace => 1
44 };
45 }
46 }
47 3 return @posts;
48 }
49 15 1;
« lib/Tweet/ToDelicious/Entity/Interface.pm ↑ Summary lib/Tweet/ToDelicious/Entity.pm »