| @@ 454-471 (lines=18) @@ | ||
| 451 | * |
|
| 452 | * @return string|false method name if it exists |
|
| 453 | */ |
|
| 454 | public static function getMutator($property) |
|
| 455 | { |
|
| 456 | $class = get_called_class(); |
|
| 457 | ||
| 458 | $k = $class.':'.$property; |
|
| 459 | if (!array_key_exists($k, self::$mutators)) { |
|
| 460 | $inflector = Inflector::get(); |
|
| 461 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 462 | ||
| 463 | if (!method_exists($class, $method)) { |
|
| 464 | $method = false; |
|
| 465 | } |
|
| 466 | ||
| 467 | self::$mutators[$k] = $method; |
|
| 468 | } |
|
| 469 | ||
| 470 | return self::$mutators[$k]; |
|
| 471 | } |
|
| 472 | ||
| 473 | /** |
|
| 474 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 482-499 (lines=18) @@ | ||
| 479 | * |
|
| 480 | * @return string|false method name if it exists |
|
| 481 | */ |
|
| 482 | public static function getAccessor($property) |
|
| 483 | { |
|
| 484 | $class = get_called_class(); |
|
| 485 | ||
| 486 | $k = $class.':'.$property; |
|
| 487 | if (!array_key_exists($k, self::$accessors)) { |
|
| 488 | $inflector = Inflector::get(); |
|
| 489 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 490 | ||
| 491 | if (!method_exists($class, $method)) { |
|
| 492 | $method = false; |
|
| 493 | } |
|
| 494 | ||
| 495 | self::$accessors[$k] = $method; |
|
| 496 | } |
|
| 497 | ||
| 498 | return self::$accessors[$k]; |
|
| 499 | } |
|
| 500 | ||
| 501 | /** |
|
| 502 | * Checks if a given property is a relationship. |
|