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 / Nullable.php src/Midori/Nullable.php
100755 95 lines (86 sloc) 1.697 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
<?php
 
/**
* the abstract class which represents a nullable box type.
*
* <pre class="brush: php">
* $obj = new Midori_Int32(null);
* echo $obj; // output will be 0;
* if(!$obj->hasValue)
* echo "I am null!";
* </pre>
*
* @author Michael
* @package Midori
* @see get_class()
* @see function_exists()
* @property boolean $hasValue Gets whether or not the value is not null.
* @property-read string $nullReplacementValue; Get the defaulted value for __toString when the value is null.
*/
abstract class Midori_Nullable extends Midori_Object
{
 
/**
* gets the default value that will replace the value
* when __toString() is called.
*
* @ignore
* @return string
*/
protected function getNullReplacementValue()
{
return "";
}
 
/**
* gets the value
*
* @ignore
* @return mixed
*/
protected function getValue()
{
return $this->get("value");
}
 
/**
* sets the value
*
* @ignore
* @param mixed $value
* @return void
*/
protected function setValue($value)
{
$this->set("value", $value);
}
 
/**
* gets if the object has a value.
*
* @ignore
* @return boolean
*/
protected function getHasValue()
{
return ($this->value != null);
}
 
/**
*
*
*
*/
public function __toString()
{
if($this->hasValue)
return "$this->value";
return $this->nullReplacementValue;
}
 
protected function val($value)
{
if($value instanceof Midori_Nullable)
return $value->value;
return $value;
}
 
}
 
function val($value)
{
if($value instanceof Midori_Nullable)
return $value->value;
return $value;
}
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