Get the names of all public methods.

@param mixed $object
@return array
173886
public function methods($object)
    {
        $methods = (new ReflectionClass($object))->getMethods(ReflectionMethod::IS_PUBLIC);

        $iterator = function(ReflectionMethod $method)
        {
            return $method->getName();
        };

        return array_map($iterator, $methods);
    }
1078544
private function serializeObjectRecursively($object): array
    {
        $reflection = new ReflectionClass($object);
        $properties = $reflection->getProperties();

        $data = [];
        foreach ($properties as $property) {
            $name = $property->getName();

            $property->setAccessible(true);
            $value = $property->getValue($object);
            $property->setAccessible(false);

            $data[$name] = $this->serializeValue($value);
        }

        return [
            'class' => get_class($object),
            'payload' => $data,
        ];
    }
458029
public static function toArray($object): array
    {
        $array = array();

        $class = get_class($object);

        $methods = get_class_methods($class);

        foreach ($methods as $method) {

            preg_match(' /^(get)(.*?)$/i', $method, $results);

            $pre = $results[1] ?? '';

            $k = $results[2] ?? '';

            $k = strtolower(substr($k, 0, 1)) . substr($k, 1);

            if ($pre == 'get') {

                $array[$k] = $object->$method();
            }
        }
        return array_filter($array);
    }
61752
protected function getObjectValues(object $object): array
    {
        $class = new ReflectionClass(get_class($object));
        $constructor = $class->getConstructor();
        if ($constructor instanceof ReflectionMethod) {
            foreach ($constructor->getParameters() as $parameter) {
                $name = $parameter->getName();

                $property = $class->getProperty($name);
                $property->setAccessible(true);

                $value = $property->getValue($object);
                if (is_object($value) === true) {
                    $value = $this->getObjectValues($value);
                }

                $data[$name] = $value;
            }
        }

        return $data ?? [];
    }
580944
protected function getSetProps($object = null) {
    $object = $object ?: $this->value;
    if (gettype($object) !== 'object') {
      return [];
    }

    return array_keys((array) $object);
  }
962055
public function getLabeledPropertiesToBeSet($object)
    {
        return array_filter($this->getLabeledProperties(), function (LabeledPropertyMetadata $labeledPropertyMetadata) use ($object) {
            return true === $labeledPropertyMetadata->getValue($object);
        });
    }
1130061
public static function getLabels($object)
    {
        $labels    = null;
        $labelsRaw = $object->getDataValue('stitky');

        if (strlen($labelsRaw)) {
            $labels = is_array($labelsRaw) ? $labelsRaw : self::listToArray($labelsRaw);
        }
        return $labels;
    }
56840
static function all($object)
	{
		$bindings = bors_find_all('common_keyword_bind', array(
			'target_class_id' => $object->class_id(),
			'target_object_id' => $object->id(),
		));

		$keyword_ids = bors_field_array_extract($bindings, 'keyword_id');
		$keywords = bors_find_all(__CLASS__, array('id IN' => $keyword_ids));
		return bors_field_array_extract($keywords, 'title');
	}
798216
protected function objectProperties($object)
    {
        $properties = array();
        $reflector = new ReflectionObject($object);

        while ($reflector) {
            foreach ($reflector->getProperties() as $property) {
                if ($property->isStatic()) {
                    continue;
                }

                $key = sprintf(
                    '%s::%s',
                    $property->getDeclaringClass()->getName(),
                    $property->getName()
                );

                $property->setAccessible(true);
                $properties[$key] = $property->getValue($object);
            }

            $reflector = $reflector->getParentClass();
        }

        return $properties;
    }
953126
protected function _getObjectFieldValues($object)
    {
        $result = array();
        $fields = $object->getFieldNames();
        $tableName = $object->getCoreTableName();
        foreach ($fields as $field) {
            $fieldName = $tableName.'__'.$field;
            $result[$field] = $object->$fieldName->value;
        }

        return $result;
    }
1259456
public function all($object=true)
  {
    $properties = get_object_vars($this);
    
    if ( $object ){
      return (object)$properties;
    }
    
    return $properties;
  }
1218904
public static function getExtractPropertys($object)
    {
        $list = AnnotationManager::getPropertiesAnnotations(BeanFactory::getObjectClass($object), ExtractProperty::class);
        if(null !== $list)
        {
            return $list;
        }
        else
        {
            return [];
        }
    }
192849
private static function getPropertyMapping($object)
    {
        $mapping = array();
        $reflection = new \ReflectionClass($object);

        // Create a default property mapping by getting the properties
        foreach ($reflection->getProperties() as $property) {
            $name = $property->getName();
            $setterMethod = 'set' . ucfirst($name);

            if (method_exists($object, $setterMethod) || $property->isPublic()) {
                $mapping[$name] = $name;
            }
        }

        // If the getPropertyMapping method exists, merge it with the
        // existing mapping.
        //
        // This comes last because it has higher priority than the default
        // mapping.
        if (method_exists($object, 'getPropertyMapping')) {
            $mapping = array_merge($mapping, $object->getPropertyMapping());
        }

        // Filter any properties that are mapped to null
        foreach ($mapping as $destination => $source) {
            if (!$source) {
                unset($mapping[$destination]);
            }
        }

        return $mapping;
    }
1068193
protected function callMethods($object)
    {
        if (! empty($this->methods)) {
            foreach ($this->methods as $method => $args) {
                $reflection = new \ReflectionMethod($object, $method);

                $arguments = array();

                foreach ($args as $arg) {
                    if (is_string($arg) && (class_exists($arg) || $this->container->bound($arg))) {
                        $arguments[] = $this->container->resolve($arg);
                        continue;
                    }

                    $arguments[] = $arg;
                }

                $reflection->invokeArgs($object, $arguments);
            }
        }

        return $object;
    }
73461
static private function objToArray(&$object)
    {
        if (is_object($object) && method_exists($object, '__trace')){
            $arr = $object->__trace();
            if (!is_array($arr)) return $arr;
        }else{
            $arr = (array)$object;
        }
        $result = [];
        while (list ($key, $value) = each($arr)){
            $keys = explode("\0", $key);
            $clear_key = $keys[sizeof($keys) - 1];
            $result[$clear_key] = &$arr[$key];
        }
        return $result;
    }
1037621
public static function keys($object)
    {
        if ($object instanceof \stdClass)
            $object = (array)$object;

        if (is_array($object))
            return array_keys($object);

        $result = [];
        static::each($object, function ($item, $key) use (& $result) {
            $result[] = $key;
        });

        return $result;
    }
699435
private static function getReflectionProperties($object)
    {
        $class = get_class($object);

        if (!isset(self::$reflectionProperties[$class])) {
            $reflection = new \ReflectionClass($object);
            $reflectionProperties = array_filter($reflection->getProperties(), function($property) {
                // We only need object context properties???
                return !$property->isStatic();
            });
            self::$reflectionProperties[$class] = [];

            foreach ($reflectionProperties as $property) {
                // Is it always necessary?
                $property->setAccessible(true);

                self::$reflectionProperties[$class][$property->getName()] = $property;
            }
        }

        return self::$reflectionProperties[$class];
    }