src/PropifierTrait.php
private static function buildDependencies($obj): void {
    $name = get_class($obj);

    if(!array_key_exists($name, self::$method_map)) {
      try {
        $class = new ReflectionClass($obj);
      } catch(ReflectionException $e) {
        throw new RuntimeException("This shouldn't be possible", 0, $e);
      }

      $methods = $class->getMethods(ReflectionMethod::IS_PROTECTED);
      $properties = self::filterProperties($methods);

      $inflector = Inflector::get();

      $method_map = self::remapProperties([$inflector, 'underscore'], $properties);

      self::$method_map[$name] = self::extractProperties($method_map);
    }
  }
private static function buildDependencies($obj): void {
    $name = get_class($obj);

    if(!array_key_exists($name, self::$method_map)) {
      try {
        $class = new ReflectionClass($obj);
      } catch(ReflectionException $e) {
        throw new RuntimeException("This shouldn't be possible", 0, $e);
      }

      $methods = $class->getMethods(ReflectionMethod::IS_PROTECTED);
      $properties = self::filterProperties($methods);

      $inflector = Inflector::get();

      $method_map = self::remapProperties([$inflector, 'underscore'], $properties);

      self::$method_map[$name] = self::extractProperties($method_map);
    }
  }
private static function buildDependencies ( $ obj ) : void { $ name = get_class ( $ obj ) ; if ( ! array_key_exists ( $ name , self :: $ method_map ) ) { try { $ class = new ReflectionClass ( $ obj ) ; } catch ( ReflectionException $ e ) { throw new RuntimeException ( "This shouldn't be possible" , 0 , $ e ) ; } $ methods = $ class -> getMethods ( ReflectionMethod :: IS_PROTECTED ) ; $ properties = self :: filterProperties ( $ methods ) ; $ inflector = Inflector :: get ( ) ; $ method_map = self :: remapProperties ( [ $ inflector , 'underscore' ] , $ properties ) ; self :: $ method_map [ $ name ] = self :: extractProperties ( $ method_map ) ; } }
Builds and caches the properties for a given object, if not already cached

@throws  MismatchedPropertiesException  If one property is an array property and the other isn't
@throws  InvalidPropertyException       If a property has an invalid number of arguments

@param  object  $obj  The object to cache

@return  void
Builds and caches the properties for a given object if not already cached