mirror of
https://github.com/dg/dibi.git
synced 2025-08-12 09:04:24 +02:00
added NClass
This commit is contained in:
@@ -453,28 +453,24 @@ abstract class DibiResult extends NObject implements IteratorAggregate, Countabl
|
||||
*/
|
||||
public function dump()
|
||||
{
|
||||
echo '<table class="dump">';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th>#row</th>';
|
||||
echo "\n<table class=\"dump\">\n<thead>\n\t<tr>\n\t\t<th>#row</th>\n";
|
||||
|
||||
foreach ($this->getFields() as $field) {
|
||||
echo '<th>' . htmlSpecialChars($field) . '</th>';
|
||||
echo "\t\t<th>" . htmlSpecialChars($field) . "</th>\n";
|
||||
}
|
||||
echo '</tr>';
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
|
||||
echo "\t</tr>\n</thead>\n<tbody>\n";
|
||||
|
||||
foreach ($this as $row => $fields) {
|
||||
echo '<tr><th>', $row, '</th>';
|
||||
echo "\t<tr>\n\t\t<th>", $row, "</th>\n";
|
||||
foreach ($fields as $field) {
|
||||
//if (is_object($field)) $field = $field->__toString();
|
||||
echo '<td>', htmlSpecialChars($field), '</td>';
|
||||
echo "\t\t<td>", htmlSpecialChars($field), "</td>\n";
|
||||
}
|
||||
echo '</tr>';
|
||||
echo "\t</tr>\n";
|
||||
}
|
||||
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
echo "</tbody>\n</table>\n";
|
||||
}
|
||||
|
||||
|
||||
|
@@ -76,23 +76,11 @@ abstract class NObject
|
||||
/**
|
||||
* Access to reflection
|
||||
*
|
||||
* @return ReflectionClass
|
||||
* @return ReflectionObject
|
||||
*/
|
||||
final public function getReflection()
|
||||
{
|
||||
return new ReflectionClass(get_class($this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return hash id for given object
|
||||
*
|
||||
* @return string 32 hexa chars
|
||||
*/
|
||||
final public function getHashId()
|
||||
{
|
||||
return spl_object_hash($this);
|
||||
return new ReflectionObject($this);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +205,7 @@ abstract class NObject
|
||||
|
||||
|
||||
/**
|
||||
* Is method defined? Case sensitive, filters protected & private, doesn't recognize static methods (works good since 5.0.4)
|
||||
* Does method exist? Case sensitive, filters protected & private, doesn't recognize static methods (works good since 5.0.4)
|
||||
*
|
||||
* @param string class name
|
||||
* @param string method name
|
||||
@@ -236,4 +224,18 @@ abstract class NObject
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* NClass is the ultimate ancestor of all uninstantiable classes.
|
||||
*/
|
||||
abstract class NClass
|
||||
{
|
||||
|
||||
final public function __construct()
|
||||
{
|
||||
throw new LogicException("Cannot instantiate static class " . get_class($this));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user