| @@ 471-488 (lines=18) @@ | ||
| 468 | * |
|
| 469 | * @return string|false method name if it exists |
|
| 470 | */ |
|
| 471 | public static function getMutator($property) |
|
| 472 | { |
|
| 473 | $class = get_called_class(); |
|
| 474 | ||
| 475 | $k = $class.':'.$property; |
|
| 476 | if (!array_key_exists($k, self::$mutators)) { |
|
| 477 | $inflector = Inflector::get(); |
|
| 478 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 479 | ||
| 480 | if (!method_exists($class, $method)) { |
|
| 481 | $method = false; |
|
| 482 | } |
|
| 483 | ||
| 484 | self::$mutators[$k] = $method; |
|
| 485 | } |
|
| 486 | ||
| 487 | return self::$mutators[$k]; |
|
| 488 | } |
|
| 489 | ||
| 490 | /** |
|
| 491 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 499-516 (lines=18) @@ | ||
| 496 | * |
|
| 497 | * @return string|false method name if it exists |
|
| 498 | */ |
|
| 499 | public static function getAccessor($property) |
|
| 500 | { |
|
| 501 | $class = get_called_class(); |
|
| 502 | ||
| 503 | $k = $class.':'.$property; |
|
| 504 | if (!array_key_exists($k, self::$accessors)) { |
|
| 505 | $inflector = Inflector::get(); |
|
| 506 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 507 | ||
| 508 | if (!method_exists($class, $method)) { |
|
| 509 | $method = false; |
|
| 510 | } |
|
| 511 | ||
| 512 | self::$accessors[$k] = $method; |
|
| 513 | } |
|
| 514 | ||
| 515 | return self::$accessors[$k]; |
|
| 516 | } |
|
| 517 | ||
| 518 | /** |
|
| 519 | * Checks if a given property is a relationship. |
|