| @@ 521-538 (lines=18) @@ | ||
| 518 | * |
|
| 519 | * @return string|false method name if it exists |
|
| 520 | */ |
|
| 521 | public static function getMutator($property) |
|
| 522 | { |
|
| 523 | $class = get_called_class(); |
|
| 524 | ||
| 525 | $k = $class.':'.$property; |
|
| 526 | if (!array_key_exists($k, self::$mutators)) { |
|
| 527 | $inflector = Inflector::get(); |
|
| 528 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 529 | ||
| 530 | if (!method_exists($class, $method)) { |
|
| 531 | $method = false; |
|
| 532 | } |
|
| 533 | ||
| 534 | self::$mutators[$k] = $method; |
|
| 535 | } |
|
| 536 | ||
| 537 | return self::$mutators[$k]; |
|
| 538 | } |
|
| 539 | ||
| 540 | /** |
|
| 541 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 549-566 (lines=18) @@ | ||
| 546 | * |
|
| 547 | * @return string|false method name if it exists |
|
| 548 | */ |
|
| 549 | public static function getAccessor($property) |
|
| 550 | { |
|
| 551 | $class = get_called_class(); |
|
| 552 | ||
| 553 | $k = $class.':'.$property; |
|
| 554 | if (!array_key_exists($k, self::$accessors)) { |
|
| 555 | $inflector = Inflector::get(); |
|
| 556 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 557 | ||
| 558 | if (!method_exists($class, $method)) { |
|
| 559 | $method = false; |
|
| 560 | } |
|
| 561 | ||
| 562 | self::$accessors[$k] = $method; |
|
| 563 | } |
|
| 564 | ||
| 565 | return self::$accessors[$k]; |
|
| 566 | } |
|
| 567 | ||
| 568 | /** |
|
| 569 | * Checks if a given property is a relationship. |
|