psr12 fixes for new PHP_CodeSniffer (#4795)
[openemr.git] / interface / super / rules / library / RuleCriteriaType.php
blob72ac56147270720c711e99ab4b58f24fba965794
1 <?php
3 // Copyright (C) 2010-2011 Aron Racho <aron@mi-squred.com>
4 //
5 // 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 2
8 // of the License, or (at your option) any later version.
10 /**
11 * Description of RuleCriteriaType
13 * @author aron
15 class RuleCriteriaType
17 // codes
18 const ageMin = "age_min";
19 const ageMax = "age_max";
20 const sex = "sex";
21 const diagnosis = "diagnosis";
22 const issue = "issue";
23 const medication = "medication";
24 const allergy = "allergy";
25 const surgery = "surgery";
26 const lifestyle = "lifestyle";
27 const custom = "custom";
28 const custom_bucket = "custom_bucket";
30 var $code;
31 var $lbl;
32 var $method;
34 function __construct($code, $lbl, $method)
36 $this->lbl = $lbl;
37 $this->code = $code;
38 $this->method = $method;
41 /**
43 * @param string $value
44 * @return RuleCriteriaType
46 public static function from($code)
48 $map = self::map();
49 return $map[$code];
52 public static function values()
54 $map = self::map();
55 return array_keys($map);
58 private static function map()
60 $map = array(
61 self::ageMin => new RuleCriteriaType(self::ageMin, xl('Age min'), 'age_min'),
62 self::ageMax => new RuleCriteriaType(self::ageMax, xl('Age max'), 'age_max'),
63 self::sex => new RuleCriteriaType(self::sex, xl('Sex'), 'sex'),
65 self::issue => new RuleCriteriaType(self::issue, xl('Medical issue'), 'lists'),
66 self::diagnosis => new RuleCriteriaType(self::diagnosis, xl('Diagnosis'), 'lists'),
67 self::medication => new RuleCriteriaType(self::medication, xl('Medication'), 'lists'),
68 self::allergy => new RuleCriteriaType(self::allergy, xl('Allergy'), 'lists'),
69 self::surgery => new RuleCriteriaType(self::surgery, xl('Surgery'), 'lists'),
71 self::lifestyle => new RuleCriteriaType(self::lifestyle, xl('Lifestyle'), 'database'),
72 self::custom => new RuleCriteriaType(self::custom, xl('Custom Table'), 'database'),
73 self::custom_bucket => new RuleCriteriaType(self::custom_bucket, xl('Custom'), 'database')
75 return $map;