Commit 671df1a0 authored by Marek Szuba's avatar Marek Szuba
Browse files

Avoid using unless and the postfix form of if

parent ede045fa
......@@ -178,7 +178,9 @@ sub fetch_all_by_external_name {
sub fetch_all_by_type {
my ($self, $type_code) = @_;
throw("type code argument is required") unless $type_code;
if ( !defined $type_code ) {
throw("type code argument is required");
}
return ($self->_fetch_direct_query(['pt.code', $type_code, SQL_VARCHAR]));
}
......@@ -203,7 +205,9 @@ sub fetch_all_by_type {
sub fetch_by_dbID {
my ($self, $dbID) = @_;
throw("dbID argument is required") unless defined($dbID);
if ( !defined $dbID ) {
throw("dbID argument is required");
}
return ($self->_fetch_direct_query(['rp.rnaproduct_id', $dbID, SQL_INTEGER]))->[0];
}
......@@ -225,7 +229,9 @@ sub fetch_by_dbID {
sub fetch_by_stable_id {
my ($self, $stable_id) = @_;
throw("stable id argument is required") unless $stable_id;
if ( !defined $stable_id ) {
throw("stable id argument is required");
}
return ($self->_fetch_direct_query(['rp.stable_id', $stable_id, SQL_VARCHAR]))->[0];
}
......
......@@ -258,7 +258,9 @@ sub cdna_start {
sub created_date {
my $self = shift;
$self->{'created_date'} = shift if (@_);
if ( @_ ) {
$self->{'created_date'} = shift;
}
return $self->{'created_date'};
}
......@@ -298,7 +300,9 @@ sub display_id {
sub end {
my $self = shift;
$self->{'end'} = shift if (@_);
if ( @_ ) {
$self->{'end'} = shift;
}
return $self->{'end'};
}
......@@ -592,7 +596,9 @@ sub get_all_xrefs { ## no critic (Subroutines::RequireArgUnpacking)
sub modified_date {
my $self = shift;
$self->{'modified_date'} = shift if (@_);
if ( @_ ) {
$self->{'modified_date'} = shift;
}
return $self->{'modified_date'};
}
......@@ -635,7 +641,9 @@ sub length { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
sub load {
my ($self, $load_xrefs) = @_;
$load_xrefs = 1 unless defined($load_xrefs);
if ( !defined $load_xrefs ) {
$load_xrefs = 1;
}
$self->seq();
......@@ -682,8 +690,7 @@ sub seq {
}
return '' unless defined($self->{'seq'});
return $self->{'seq'};
return ( $self->{'seq'} // q{} );
}
......@@ -703,7 +710,9 @@ sub seq {
sub stable_id {
my $self = shift;
$self->{'stable_id'} = shift if (@_);
if ( @_ ) {
$self->{'stable_id'} = shift;
}
return $self->{'stable_id'};
}
......@@ -758,7 +767,9 @@ sub stable_id_version {
sub start {
my $self = shift;
$self->{'start'} = shift if (@_);
if ( @_ ) {
$self->{'start'} = shift;
}
return $self->{'start'};
}
......@@ -969,7 +980,9 @@ sub type_code {
sub version {
my $self = shift;
$self->{'version'} = shift if (@_);
if ( @_ ) {
$self->{'version'} = shift;
}
return $self->{'version'};
}
......
......@@ -31,7 +31,11 @@ use Test::Warnings;
use Test::Exception;
my $loaded = 0;
END { print "not ok 1 - Test set-up completed\n" unless $loaded; }
END {
if ( ! $loaded ) {
print "not ok 1 - Test set-up completed\n";
}
}
use Bio::EnsEMBL::Test::MultiTestDB;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment