diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-01-29 02:34:50 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-01-29 02:34:50 +0100 |
commit | 64ac1605b6fe8e997134dd57cc30f30b99ebc076 (patch) | |
tree | d4fd89c68f0f0eb7b49ea92336f8f8ab5f778e45 /app/class/Record.php | |
parent | b6173772bdef1eaf067573373ab500d67dfc454d (diff) | |
download | wcms-64ac1605b6fe8e997134dd57cc30f30b99ebc076.tar.gz wcms-64ac1605b6fe8e997134dd57cc30f30b99ebc076.zip |
refactor : item abstract class
new Item abstract class with hydrate and dry functions to clean others
Diffstat (limited to 'app/class/Record.php')
-rw-r--r-- | app/class/Record.php | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/app/class/Record.php b/app/class/Record.php deleted file mode 100644 index 381f10a..0000000 --- a/app/class/Record.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php - -namespace Wcms; - -class Record -{ - private $id; - private $path; - private $extension; - private $size; - private $datetime; - private $number; - - - -// _____________________________________________________ F U N ____________________________________________________ - - public function __construct(array $donnees) - { - $this->hydrate($donnees); - } - - public function hydrate(array $donnees) - { - foreach ($donnees as $key => $value) { - $method = 'set' . $key; - - if (method_exists($this, $method)) { - $this->$method($value); - } - } - } - - - -// _________________________________________________ G E T ____________________________________________________ - - public function id() - { - return $this->id; - } - - public function path() - { - return $this->path; - } - - public function extension() - { - return $this->extension; - } - - public function size() - { - return $this->size; - } - - public function datetime() - { - return $this->datetime; - } - - public function number() - { - return $this->number; - } - -// ___________________________________________________ S E T __________________________________________________ - - public function setid($id) - { - if (strlen($id) < 100 and is_string($id)) { - $this->id = strip_tags(strtolower($id)); - } - } - - public function setpath($path) - { - if (strlen($path) < 40 and is_string($path)) { - $this->path = strip_tags(strtolower($path)); - } - } - - public function setextension($extension) - { - if (strlen($extension) < 7 and is_string($extension)) { - $this->extension = strip_tags(strtolower($extension)); - } - } - - public function setsize($size) - { - if (40 and is_int($size)) { - $this->size = strip_tags(strtolower($size)); - } - } - - public function setdatetime($datetime) - { - if (is_int($datetime)) { - $this->datetime = strip_tags(strtolower($datetime)); - } - } - - public function setnumber($number) - { - if (is_int($number)) { - $this->number = strip_tags(strtolower($number)); - } - } - - - - - -} - -?>
\ No newline at end of file |