| @@ 415-432 (lines=18) @@ | ||
| 412 | * |
|
| 413 | * @return string|false method name if it exists |
|
| 414 | */ |
|
| 415 | public static function getMutator($property) |
|
| 416 | { |
|
| 417 | $class = get_called_class(); |
|
| 418 | ||
| 419 | $k = $class.':'.$property; |
|
| 420 | if (!array_key_exists($k, self::$mutators)) { |
|
| 421 | $inflector = Inflector::get(); |
|
| 422 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 423 | ||
| 424 | if (!method_exists($class, $method)) { |
|
| 425 | $method = false; |
|
| 426 | } |
|
| 427 | ||
| 428 | self::$mutators[$k] = $method; |
|
| 429 | } |
|
| 430 | ||
| 431 | return self::$mutators[$k]; |
|
| 432 | } |
|
| 433 | ||
| 434 | /** |
|
| 435 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 443-460 (lines=18) @@ | ||
| 440 | * |
|
| 441 | * @return string|false method name if it exists |
|
| 442 | */ |
|
| 443 | public static function getAccessor($property) |
|
| 444 | { |
|
| 445 | $class = get_called_class(); |
|
| 446 | ||
| 447 | $k = $class.':'.$property; |
|
| 448 | if (!array_key_exists($k, self::$accessors)) { |
|
| 449 | $inflector = Inflector::get(); |
|
| 450 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 451 | ||
| 452 | if (!method_exists($class, $method)) { |
|
| 453 | $method = false; |
|
| 454 | } |
|
| 455 | ||
| 456 | self::$accessors[$k] = $method; |
|
| 457 | } |
|
| 458 | ||
| 459 | return self::$accessors[$k]; |
|
| 460 | } |
|
| 461 | ||
| 462 | /** |
|
| 463 | * Checks if a given property is a relationship. |
|