| @@ 424-441 (lines=18) @@ | ||
| 421 | * |
|
| 422 | * @return string|false method name if it exists |
|
| 423 | */ |
|
| 424 | public static function getMutator($property) |
|
| 425 | { |
|
| 426 | $class = get_called_class(); |
|
| 427 | ||
| 428 | $k = $class.':'.$property; |
|
| 429 | if (!array_key_exists($k, self::$mutators)) { |
|
| 430 | $inflector = Inflector::get(); |
|
| 431 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 432 | ||
| 433 | if (!method_exists($class, $method)) { |
|
| 434 | $method = false; |
|
| 435 | } |
|
| 436 | ||
| 437 | self::$mutators[$k] = $method; |
|
| 438 | } |
|
| 439 | ||
| 440 | return self::$mutators[$k]; |
|
| 441 | } |
|
| 442 | ||
| 443 | /** |
|
| 444 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 452-469 (lines=18) @@ | ||
| 449 | * |
|
| 450 | * @return string|false method name if it exists |
|
| 451 | */ |
|
| 452 | public static function getAccessor($property) |
|
| 453 | { |
|
| 454 | $class = get_called_class(); |
|
| 455 | ||
| 456 | $k = $class.':'.$property; |
|
| 457 | if (!array_key_exists($k, self::$accessors)) { |
|
| 458 | $inflector = Inflector::get(); |
|
| 459 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 460 | ||
| 461 | if (!method_exists($class, $method)) { |
|
| 462 | $method = false; |
|
| 463 | } |
|
| 464 | ||
| 465 | self::$accessors[$k] = $method; |
|
| 466 | } |
|
| 467 | ||
| 468 | return self::$accessors[$k]; |
|
| 469 | } |
|
| 470 | ||
| 471 | /** |
|
| 472 | * Checks if a given property is a relationship. |
|