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