| @@ 571-588 (lines=18) @@ | ||
| 568 | * |
|
| 569 | * @return string|false method name if it exists |
|
| 570 | */ |
|
| 571 | public static function getMutator($property) |
|
| 572 | { |
|
| 573 | $class = get_called_class(); |
|
| 574 | ||
| 575 | $k = $class.':'.$property; |
|
| 576 | if (!array_key_exists($k, self::$mutators)) { |
|
| 577 | $inflector = Inflector::get(); |
|
| 578 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 579 | ||
| 580 | if (!method_exists($class, $method)) { |
|
| 581 | $method = false; |
|
| 582 | } |
|
| 583 | ||
| 584 | self::$mutators[$k] = $method; |
|
| 585 | } |
|
| 586 | ||
| 587 | return self::$mutators[$k]; |
|
| 588 | } |
|
| 589 | ||
| 590 | /** |
|
| 591 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 599-616 (lines=18) @@ | ||
| 596 | * |
|
| 597 | * @return string|false method name if it exists |
|
| 598 | */ |
|
| 599 | public static function getAccessor($property) |
|
| 600 | { |
|
| 601 | $class = get_called_class(); |
|
| 602 | ||
| 603 | $k = $class.':'.$property; |
|
| 604 | if (!array_key_exists($k, self::$accessors)) { |
|
| 605 | $inflector = Inflector::get(); |
|
| 606 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 607 | ||
| 608 | if (!method_exists($class, $method)) { |
|
| 609 | $method = false; |
|
| 610 | } |
|
| 611 | ||
| 612 | self::$accessors[$k] = $method; |
|
| 613 | } |
|
| 614 | ||
| 615 | return self::$accessors[$k]; |
|
| 616 | } |
|
| 617 | ||
| 618 | /** |
|
| 619 | * Marshals a value for a given property from storage. |
|