Removed more redundant functions
This commit is contained in:
@@ -40,19 +40,6 @@ abstract class Catalog extends Model
|
||||
return config(static::config.'.dir').'/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim a string
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $chrs
|
||||
* @return string
|
||||
* @todo This should go in as a helper
|
||||
*/
|
||||
public static function stringtrim(string $string,int $chrs=6)
|
||||
{
|
||||
return sprintf('%s...%s',substr($string,0,$chrs),substr($string,-1*$chrs));
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
@@ -259,48 +246,6 @@ abstract class Catalog extends Model
|
||||
|
||||
/* METHODS */
|
||||
|
||||
/**
|
||||
* Date the multimedia was created
|
||||
*
|
||||
* @deprecated use $this->created
|
||||
*/
|
||||
public function date_taken(): string
|
||||
{
|
||||
Log::alert(__METHOD__.' deprecated');
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
/** @deprecated use $this->device */
|
||||
public function device(): string
|
||||
{
|
||||
Log::alert(__METHOD__.' deprecated');
|
||||
return $this->device;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the date of the file
|
||||
*/
|
||||
public function file_date(string $type): ?Carbon
|
||||
{
|
||||
if (! $this->isReadable())
|
||||
return NULL;
|
||||
|
||||
$t = NULL;
|
||||
|
||||
switch ($type) {
|
||||
case 'a': $t = fileatime($this->file_name(FALSE));
|
||||
break;
|
||||
|
||||
case 'c': $t = filectime($this->file_name(FALSE));
|
||||
break;
|
||||
|
||||
case 'm': $t = filemtime($this->file_name(FALSE));
|
||||
break;
|
||||
}
|
||||
|
||||
return $t ? Carbon::createfromTimestamp($t) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the filename.
|
||||
* If short is TRUE, it is the filename that it should be called (and can be compared to $this->filename)
|
||||
@@ -353,17 +298,6 @@ abstract class Catalog extends Model
|
||||
return trim(chunk_split(sprintf("%0{$depth}s",$this->id),$sep,'/'),'/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file size
|
||||
* @deprecated use $this->getFileSizeAttribute())
|
||||
*/
|
||||
public function file_size()
|
||||
{
|
||||
Log::alert(__METHOD__.' deprecated');
|
||||
|
||||
return (! is_readable($this->file_name(FALSE))) ? NULL : filesize($this->file_name(FALSE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML Checkbox for duplicate
|
||||
* @deprecated use a component
|
||||
@@ -416,15 +350,6 @@ abstract class Catalog extends Model
|
||||
return $this->HTMLCheckbox('remove',$this->id,$this->remove);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the GPS coordinates
|
||||
* @deprecated use getGPSAttribute()
|
||||
*/
|
||||
public function gps(): string
|
||||
{
|
||||
return $this->getGPSAttribute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an HTML checkbox
|
||||
* @deprecated use a component
|
||||
@@ -628,7 +553,7 @@ abstract class Catalog extends Model
|
||||
public function signature($short=FALSE)
|
||||
{
|
||||
return ($short && $this->signature)
|
||||
? static::stringtrim($this->signature)
|
||||
? stringtrim($this->signature)
|
||||
: $this->signature;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user