| @@ 481-498 (lines=18) @@ | ||
| 478 | * |
|
| 479 | * @return string|false method name if it exists |
|
| 480 | */ |
|
| 481 | public static function getMutator($property) |
|
| 482 | { |
|
| 483 | $class = get_called_class(); |
|
| 484 | ||
| 485 | $k = $class.':'.$property; |
|
| 486 | if (!array_key_exists($k, self::$mutators)) { |
|
| 487 | $inflector = Inflector::get(); |
|
| 488 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 489 | ||
| 490 | if (!method_exists($class, $method)) { |
|
| 491 | $method = false; |
|
| 492 | } |
|
| 493 | ||
| 494 | self::$mutators[$k] = $method; |
|
| 495 | } |
|
| 496 | ||
| 497 | return self::$mutators[$k]; |
|
| 498 | } |
|
| 499 | ||
| 500 | /** |
|
| 501 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 509-526 (lines=18) @@ | ||
| 506 | * |
|
| 507 | * @return string|false method name if it exists |
|
| 508 | */ |
|
| 509 | public static function getAccessor($property) |
|
| 510 | { |
|
| 511 | $class = get_called_class(); |
|
| 512 | ||
| 513 | $k = $class.':'.$property; |
|
| 514 | if (!array_key_exists($k, self::$accessors)) { |
|
| 515 | $inflector = Inflector::get(); |
|
| 516 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 517 | ||
| 518 | if (!method_exists($class, $method)) { |
|
| 519 | $method = false; |
|
| 520 | } |
|
| 521 | ||
| 522 | self::$accessors[$k] = $method; |
|
| 523 | } |
|
| 524 | ||
| 525 | return self::$accessors[$k]; |
|
| 526 | } |
|
| 527 | ||
| 528 | /** |
|
| 529 | * Checks if a given property is a relationship. |
|