Highway to PSR2
[openemr.git] / interface / modules / zend_modules / module / Multipledb / src / Multipledb / Model / Multipledb.php
blob8ff86f905f2f9c6331d4c84f0a38063089df72da
1 <?php
3 /* +-----------------------------------------------------------------------------+
4 * Copyright 2016 matrix israel
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 3
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see
15 * http://www.gnu.org/licenses/licenses.html#GPL
16 * @author Oshri Rozmarin <oshri.rozmarin@gmail.com>
17 * +------------------------------------------------------------------------------+
21 namespace Multipledb\Model;
23 use Zend\InputFilter\InputFilter;
24 use Zend\InputFilter\InputFilterAwareInterface;
25 use Zend\InputFilter\InputFilterInterface;
27 class Multipledb implements InputFilterAwareInterface
30 const FIELD_ID = "id";
31 public $id;
32 public $namespace;
33 public $username;
34 public $password;
35 public $dbname;
36 public $host;
37 public $port;
38 public $date;
40 public function exchangeArray($data)
43 $this->id = (!empty($data['id'])) ? $data['id'] : null;
44 $this->namespace = (!empty($data['namespace'])) ? $data['namespace'] : null;
45 $this->username = (!empty($data['username'])) ? $data['username'] : null;
46 $this->password = (!empty($data['password'])) ? $data['password'] : null;
47 $this->dbname = (!empty($data['dbname'])) ? $data['dbname'] : null;
48 $this->host = (!empty($data['host'])) ? $data['host'] : null;
49 $this->port = (!empty($data['port'])) ? $data['port'] : null;
50 $this->date = (!empty($data['date'])) ? $data['date'] : null;
55 public static $inputsValidations = array(
56 array(
57 'name' => 'id',
58 'required' => true,
59 'filters' => array(
60 array('name' => 'Int'),
63 array(
64 'name' => 'namespace',
65 'required' => true,
68 array(
69 'name' => 'username',
70 'required' => true,
73 array(
74 'name' => 'password',
75 'required' => true,
77 array(
78 'name' => 'dbname',
79 'required' => true,
81 array(
82 'name' => 'host',
83 'required' => true,
85 array(
86 'name' => 'port',
87 'required' => true,
88 'filters' => array(
89 array('name' => 'Int'),
96 public function setInputFilter(InputFilterInterface $inputFilter)
98 throw new \Exception("Not used");
101 public function getInputFilter()
103 if (!$this->inputFilter) {
104 $inputFilter = new InputFilter();
106 foreach (self::$inputsValidations as $input) {
107 $inputFilter->add($input);
110 $this->inputFilter = $inputFilter;
113 return $this->inputFilter;