| @@ 532-549 (lines=18) @@ | ||
| 529 | * |
|
| 530 | * @return string|false method name if it exists |
|
| 531 | */ |
|
| 532 | public static function getMutator($property) |
|
| 533 | { |
|
| 534 | $class = get_called_class(); |
|
| 535 | ||
| 536 | $k = $class.':'.$property; |
|
| 537 | if (!array_key_exists($k, self::$mutators)) { |
|
| 538 | $inflector = Inflector::get(); |
|
| 539 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 540 | ||
| 541 | if (!method_exists($class, $method)) { |
|
| 542 | $method = false; |
|
| 543 | } |
|
| 544 | ||
| 545 | self::$mutators[$k] = $method; |
|
| 546 | } |
|
| 547 | ||
| 548 | return self::$mutators[$k]; |
|
| 549 | } |
|
| 550 | ||
| 551 | /** |
|
| 552 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 560-577 (lines=18) @@ | ||
| 557 | * |
|
| 558 | * @return string|false method name if it exists |
|
| 559 | */ |
|
| 560 | public static function getAccessor($property) |
|
| 561 | { |
|
| 562 | $class = get_called_class(); |
|
| 563 | ||
| 564 | $k = $class.':'.$property; |
|
| 565 | if (!array_key_exists($k, self::$accessors)) { |
|
| 566 | $inflector = Inflector::get(); |
|
| 567 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 568 | ||
| 569 | if (!method_exists($class, $method)) { |
|
| 570 | $method = false; |
|
| 571 | } |
|
| 572 | ||
| 573 | self::$accessors[$k] = $method; |
|
| 574 | } |
|
| 575 | ||
| 576 | return self::$accessors[$k]; |
|
| 577 | } |
|
| 578 | ||
| 579 | /** |
|
| 580 | * Checks if a given property is a relationship. |
|