| 1 | package OPTIMADE::PropertyDefinitions::Property; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # ABSTRACT: OPTIMADE Property | ||||||||||||||||||||||||||||
| 4 | 2 | our $VERSION = '0.1.0'; # VERSION | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use List::Util qw( any ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use OPTIMADE::PropertyDefinitions::Property::Nested; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | sub new | ||||||||||||||||||||||||||||
| 13 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 0 | my( $class, $parent, $name ) = @_; | |||||||||||||||||||||||||||
| 15 | 0 | return bless { parent => $parent, name => $name }, $class; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub name() { $_[0]->{name} } | ||||||||||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub parent() { $_[0]->{parent} } | ||||||||||||||||||||||||||
|
Subroutine
parent: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | sub property($) | ||||||||||||||||||||||||||||
| 22 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
property: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | 0 | my( $self, $property ) = @_; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | if( !exists $self->raw->{properties} || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->raw->{"properties"} and exists $self->raw->{"properties"}{$property}
MC/DC0%0/2
exists $self->raw->{"properties"} and exists $self->raw->{"properties"}{$property}
exists $self->raw->{"properties"}
exists $self->raw->{"properties"}{$property}
Truth table0%0/3
A and B
A= exists $self->raw->{"properties"}B= exists $self->raw->{"properties"}{$property}
| |||||||||||||||||||||||||||||
| 26 | !exists $self->raw->{properties}{$property} ) { | ||||||||||||||||||||||||||||
| 27 | 0 | die "no such property '$property'\n"; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | return OPTIMADE::PropertyDefinitions::Property::Nested->new( $self, $property ); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub properties() | ||||||||||||||||||||||||||||
| 34 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
properties: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | my( $self ) = @_; | |||||||||||||||||||||||||||
| 36 | 0 | ▶ | return my @empty unless exists $self->raw->{properties}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | return map { OPTIMADE::PropertyDefinitions::Property::Nested->new( $self, $_ ) } | |||||||||||||||||||||||||||
| 38 | 0 | sort keys %{$self->raw->{properties}}; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub description() { $_[0]->raw->{description} } | ||||||||||||||||||||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub format() { $_[0]->raw->{format} } | ||||||||||||||||||||||||||
|
Subroutine
format: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub optimade_type() { $_[0]->raw->{'x-optimade-type'} } | ||||||||||||||||||||||||||
|
Subroutine
optimade_type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub query_support() { $_[0]->parent->raw->{'query-support'} } | ||||||||||||||||||||||||||
|
Subroutine
query_support: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub required() { exists $_[0]->raw->{required} ? @{$_[0]->raw->{required}} : my @empty } | ||||||||||||||||||||||||||
|
Subroutine
required: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub response_level() { $_[0]->parent->raw->{'response-level'} } | ||||||||||||||||||||||||||
|
Subroutine
response_level: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub sortable() { $_[0]->parent->raw->{sortable} } | ||||||||||||||||||||||||||
|
Subroutine
sortable: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub support() { $_[0]->parent->raw->{support} } | ||||||||||||||||||||||||||
|
Subroutine
support: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub type() { @{$_[0]->raw->{type}} } | ||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub unit() { $_[0]->raw->{'x-optimade-unit'} } | ||||||||||||||||||||||||||
|
Subroutine
unit: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub version() { $_[0]->raw->{version} } | ||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub is_nullable() { any { $_ eq 'null' } $_[0]->type } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
is_nullable: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub raw() { $_[0]->parent->raw->{properties}{$_[0]->name} } | ||||||||||||||||||||||||||
|
Subroutine
raw: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 2 | 1; | |||||||||||||||||||||||||||