summaryrefslogtreecommitdiff
blob: 8062d0d35eaab72d56911f01c6aa096fbf798926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?

	class PortageAtom extends PortageEbuild {
	
		// Ranges
		private $gt; // greater than >
		private $lt; // lesser than <
		private $eq; // equals =
		private $ar; // any revision ~
		private $av; // any version *
		
		private $arr_chars;
		private $arr_ranges;
		
		public $ebuild_atom;
		
		function __construct($str) {
		
			$this->gt = false;
			$this->lt = false;
			$this->eq = false;
			$this->ar = false;
			$this->av = false;
		
			// Find the ranges
			if($str[0] == '>')
				$this->gt = true;
			
			if($str[0] == '<')
				$this->lt = true;
			
			if($str[0] == '=' || $str[1] == '=')
				$this->eq = true;
				
			if($str[0] == '~')
				$this->ar = true;
			
			$end = $str[strlen($str) - 1];
			
			if($end == '*')
				$this->av = true;
				
			$this->arr_chars = array('>', '<', '=', '~', '*');
			
			foreach($this->arr_chars as $char)
				$str = str_replace($char, '', $str);
			
			$this->arr_ranges = array('gt', 'lt', 'eq', 'ar', 'av');
			
			$this->ebuild_atom = $str;
			
			
			parent::__construct($this->ebuild_atom);
		
		}
		
		function __get($str) {
		
			if(in_array($str, $this->arr_ranges))
				return $this->$str;
			else
				return parent::__get($str);
		}
	
	}

?>