github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

michaelherndon / midori-php

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 4
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (3)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: 9e83502

click here to add a description

click here to add a homepage

  • Branches (3)
    • ctp
    • master
    • php5.2.x
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

moved the official repo to http://github.com/amptools-net/midori-php/tree/trunk — Read more

  cancel

http://www.amptools.net

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

adding inflector, Midori_Regex adding methods to string, endsWith, gsub, 
indexOf, insert, lastIndexOf, match, padLeft, padRight, replace, trim,  
also adding quick functions regex and val 
U-Michael-PC\Michael (author)
Sat Jun 06 17:45:59 -0700 2009
commit  9e83502e28cbc278ec6bb4a293331dce9fa9dc7f
tree    60886645af4c2c2e60d3573290dadcc199d242a7
parent  e949c8591a730dea753fb3ca6d4c30a9999fcfc4
midori-php / src / Midori / Object.php src/Midori/Object.php
100755 198 lines (179 sloc) 4.182 kb
edit raw blame history
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?php
 
/**
*
*/
 
/**
* Midori_Object is the core base class for all of the objects
* in the midori library and hold the basic methods for creating
* objects with type information in php.
*
* <p>Midori_Object is design to help create plain old php objects that
* utilize {@link http://us.php.net/oop5.magic magic methods} for properties
* which means pretty much all properties within the library are public.</p>
*
* <pre class="brush: php">
*
* /**
* *
* *
* * @property string $type
* *\/
* class Car extends Midori_Object
* {
*
* /**
* * @ignore
* *\/
* protected function getType()
* {
* return $this->get("type");
* }
*
* /**
* * @ignore
* *\/
* protected function setType($value)
* {
* $this->set("type", $value);
* }
* }
* </pre>
*
*
* @author Michael Herndon
* @package Midori
*
*/
class Midori_Object
{
 
private $fields = array();
 
/**
* static constructor for chaining purposes.
*
* <code>
* $obj = Midori_String::ctr("i am a woman")
* ->replace("woman", "man");
* echo $obj; //i am a man
* </code>
*
* @returns Midori_Object
*/
public static function ctr()
{
return new Midori_Object();
}
 
 
/**
* generic get method that pulls a property from the private
* fields array which is used to hold values for cloning purposes
* and help with api changes by having properties with gets/sets
*
* @param string $property
* @return mixed
*/
protected function get($property)
{
return isset($this->fields[$property]) ? $this->fields[$property] : null;
}
 
/**
* generic set method that sets a value in the private fields array
* which is used to hold properties for cloning purposes and help
* with api changes of having properties
*
* @param $property
* @param $value
* @return unknown_type
*/
protected function set($property, $value)
{
$this->fields[$property] = $value;
}
 
/**
* gets the name the of the current class.
*
*
* @see get_class()
* @param boolean $returnPhpString
* @return Midori_String|string
*/
public function getClassName($returnPhpString = false)
{
$name = get_class($this);
return $returnPhpString ? $name : new Midori_String($name);
}
 
/**
* gets the reflected type information about the class.
*
* @see Reflection
* @return ReflectionObject
*/
public function getReflectedType()
{
return new ReflectionObject($this);
}
 
/**
* determines if the current object is equal to the
* object being passed into this method.
*
* @param mixed $obj
* @return boolean
*/
public function equals($obj)
{
return ($obj == ($this));
}
 
/**
* coverts the object into a string value, by the object
* will generally return the name of the object.
*
* @param boolean $returnPhpString
* @return Midori_String|string
*/
public function toString($returnPhpString = false)
{
return $this->getClassName($returnPhpString);
}
 
 
/**
* magic method __get, looks for getters inside the class.
*
* @param string $property
* @return mixed
*/
public function __get($property)
{
$get = "get".$property;
return $this->$get();
}
 
/**
* magic method __set, looks for the setter insder the class
*
* @param string $property
* @param mixed $value
*/
public function __set($property, $value)
{
$set = "set".$property;
$this->$set($value);
}
 
 
/**
* magic method __clone clones the current object and returns
* the cloned object.
*
* @return self
*/
public function __clone()
{
$class = $this->getClassName(true);
$obj->fields = $this->fields;
return $obj;
}
 
/**
* magic method __toString returns the string value of the object
* and primary used for echo/print/string concatination statments.
*
* @return string
*/
public function __toString()
{
return $this->getClassName(true);
}
 
}
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server