Internal helper method to export the model's public properties.

@return array An array of key/value pairs.
199706
private function export()
    {
        $exported = new StdClass;
        foreach ($this as $name => $field) {
            if ((new ReflectionProperty($this, $name))->isPublic()) {
                if (is_object($field)) {
                    $traits = class_uses($field);
                    if (isset($traits['Ornament\Model'])
                        || isset($traits['Ornament\JsonModel'])
                    ) {
                        $exported->$name = $field->getPrimaryKey();
                    } else {
                        $exported->$name = "$field";
                    }
                } else {
                    $exported->$name = $field;
                }
            }
        }
        return $exported;
    }
1294385
public function getProperties()
    {
        $properties = [];

        // URL must precede all other properties
        if ($this->url !== null) {
            $properties[] = new Property(Property::AUDIO_URL, $this->url);
        }

        if ($this->secureUrl !== null) {
            $properties[] = new Property(Property::AUDIO_SECURE_URL, $this->secureUrl);
        }

        if ($this->type !== null) {
            $properties[] = new Property(Property::AUDIO_TYPE, $this->type);
        }

        return $properties;
    }
483410
public function toArray()
    {
        $userParameters = [];

        foreach ($this->tsProperty as $property => $tsPropObj) {
            $userParameters[$property] = $tsPropObj->getValue();
        }

        return $userParameters;
    }
827327
public function toArray()
    {
        $array = array();

        foreach($this->_data as $key=>$value)
            $array[$key] = ($value instanceof PropertyReference) ? $value->value() : $value;

        return $array;
    }
568466
public function export()
    {
        $result = new \stdClass;
        $class  = new \ReflectionClass(get_class($this));
        $plist  = $class->getProperties(\ReflectionProperty::IS_PUBLIC);
        foreach ($plist as $property) {
            $result->{$property->getName()} = $this->{$property->getName()};
        }
        return $result;
    }
20542
public function toJson() {
    	$result = array();
    	$result['name'] = $this->getName();
    
    	$modifier = "";
    	if ($this->isPublic()) {
    		$modifier = "public";
    	} elseif ($this->isProtected()) {
    		$modifier = "protected";
    	} elseif ($this->isPrivate()) {
    		$modifier = "private";
    	}
    	$result['modifier'] = $modifier;
    	$result['static'] = $this->isStatic();
    	$result['abstract'] = $this->isAbstract();
    	$result['constructor'] = $this->isConstructor();
    	$result['final'] = $this->isFinal();
    	//$result['comment'] = $this->getDocComment();
    	$result['comment'] = $this->getMoufPhpDocComment()->getJsonArray();
    
    	$result['parameters'] = array();
    	$parameters = $this->getParameters();
    	foreach ($parameters as $parameter) {
    		$result['parameters'][] = $parameter->toJson();
    	}
    
    	//$properties = $this->getAnnotations("Property");
    	try {
    		/*if (!empty($properties)) {
    		 $result['moufProperty'] = true;*/
    		
    		// TODO: is there a need to instanciate a  MoufPropertyDescriptor?
    		
    		// If this is a setter only:
    		
    		if ($this->isSetter()) {
	    		$moufPropertyDescriptor = new MoufPropertyDescriptor($this);
	    		$types = $moufPropertyDescriptor->getTypes();
	    		$result['types'] = $types->toJson();
	    		
	    		if ($types->getWarningMessage()) {
	    			$result['classinerror'] = $types->getWarningMessage();
	    		}
    		}
    		
    		/*if ($moufPropertyDescriptor->isAssociativeArray()) {
    			$result['keytype'] = $moufPropertyDescriptor->getKeyType();
    		}
    		if ($moufPropertyDescriptor->isArray()) {
    			$result['subtype'] = $moufPropertyDescriptor->getSubType();
    		}*/
    		//}
    	} catch (\Exception $e) {
    		$result['classinerror'] = $e->getMessage();
    	}
    	
    
    	return $result;
    }
1137743
protected static function define_properties() {
        return array(
            'sourcefileid' => [
                'type' => PARAM_INT,
            ],
            'targetformat' => [
                'type' => PARAM_ALPHANUMEXT,
            ],
            'status' => [
                'type' => PARAM_INT,
                'choices' => [
                    self::STATUS_PENDING,
                    self::STATUS_IN_PROGRESS,
                    self::STATUS_COMPLETE,
                    self::STATUS_FAILED,
                ],
                'default' => self::STATUS_PENDING,
            ],
            'statusmessage' => [
                'type' => PARAM_RAW,
                'null' => NULL_ALLOWED,
                'default' => null,
            ],
            'converter' => [
                'type' => PARAM_RAW,
                'null' => NULL_ALLOWED,
                'default' => null,
            ],
            'destfileid' => [
                'type' => PARAM_INT,
                'null' => NULL_ALLOWED,
                'default' => null,
            ],
            'data' => [
                'type' => PARAM_RAW,
                'null' => NULL_ALLOWED,
                'default' => null,
            ],
        );
    }
81244
public function buildProperties()
    {
        $methods            = get_class_methods($this);
        $properties         = get_object_vars($this);
        $filteredProperties = array();

        // only properties that have getters should be extracted
        foreach ($properties as $property => $value) {
            $getter = 'get' . $this->camelize($property, true);
            if (in_array($getter, $methods)) {
                $filteredProperties[$property] = $this->{$getter}();
            }
        }

        return $filteredProperties;
    }
359788
public function toArray()
    {
        $array = ['name' => $this->getName()];

        foreach (static::$propertyMap[static::class] as $name => $property) {
            $value = $this->{$name};
            $array[$name] = $value instanceof XType ? $value->toArray() : $value;
        }

        if (!count($this->constraints)) {
            return $array;
        }

        $array['constraints'] = [];

        foreach ($this->constraints as $name=>$parameters) {
            $array['constraints'][$name] = $parameters;
        }

        return $array;
    }
107343
public function getApiAttributes() : array
    {
        $attributes = [];
        foreach ($this->getProperties() as $name => $property) {
            if (array_key_exists(FFCST::PROPERTY_OPTIONS, $property)) {
                if (!in_array(FFCST::OPTION_PK, $property[FFCST::PROPERTY_OPTIONS]) &&
                    !in_array(FFCST::OPTION_JSONIGNORE, $property[FFCST::PROPERTY_OPTIONS])) {
                    $getter = 'get' . \FreeFW\Tools\PBXString::toCamelCase($name, true);
                    if (array_key_exists(FFCST::PROPERTY_PUBLIC, $property)) {
                        $attributes[$property[FFCST::PROPERTY_PUBLIC]] = $this->$getter();
                    } else {
                        $attributes[$name] = $this->$getter();
                    }
                }
            } else {
                $getter = 'get' . \FreeFW\Tools\PBXString::toCamelCase($name, true);
                if (array_key_exists(FFCST::PROPERTY_PUBLIC, $property)) {
                    $attributes[$property[FFCST::PROPERTY_PUBLIC]] = $this->$getter();
                } else {
                    $attributes[$name] = $this->$getter();
                }
            }
        }
        return $attributes;
    }
192787
public static function get_properties_for_exporter() {
        return [
            'filename' => array(
                'type' => PARAM_FILE,
                'description' => 'File name.',
                'optional' => true,
                'null' => NULL_NOT_ALLOWED,
            ),
            'filepath' => array(
                'type' => PARAM_PATH,
                'description' => 'File path.',
                'optional' => true,
                'null' => NULL_NOT_ALLOWED,
            ),
            'filesize' => array(
                'type' => PARAM_INT,
                'description' => 'File size.',
                'optional' => true,
                'null' => NULL_NOT_ALLOWED,
            ),
            'fileurl' => array(
                'type' => PARAM_URL,
                'description' => 'Downloadable file url.',
                'optional' => true,
                'null' => NULL_NOT_ALLOWED,
            ),
            'timemodified' => array(
                'type' => PARAM_INT,
                'description' => 'Time modified.',
                'optional' => true,
                'null' => NULL_NOT_ALLOWED,
            ),
            'mimetype' => array(
                'type' => PARAM_RAW,
                'description' => 'File mime type.',
                'optional' => true,
                'null' => NULL_NOT_ALLOWED,
            ),
            'isexternalfile' => array(
                'type' => PARAM_BOOL,
                'description' => 'Whether is an external file.',
                'optional' => true,
                'null' => NULL_NOT_ALLOWED,
            ),
            'repositorytype' => array(
                'type' => PARAM_PLUGIN,
                'description' => 'The repository type for the external files.',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ),
        ];
    }
800587
protected function exportInternal()
    {
        $properties = [];

        // Export the configuration & $template
        if (!$this->config) {
            throw new \RuntimeException('Invalid configuration', 1481363496);
        }

        $properties['config']    = $this->config;
        $properties['template']  = $this->template;
        $properties['extension'] = $this->extension;

        // Export the associated resources
        if (count($this->resources)) {
            $properties['resources'] = $this->resources;
        }

        // Export the notice
        if (strlen(trim($this->notice))) {
            $properties['notice'] = trim($this->notice);
        }

        // If this is the default variant
        if (!$this->variant) {
            $preview = trim(strval($this->preview));
            if (strlen($preview)) {
                $properties['preview'] = $preview;
            }
        }

        return $properties;
    }
121756
public function toArray()
    {
        if ($this->gettersVariable) {
            $var = $this->gettersVariable;

            return $this->{$var};
        }

        $properties = (array)$this;
        $list = [];
        foreach ($properties as $property => $value) {
            if ($property[0] !== "\0") {
                $list[$property] = $value;
            }
        }

        return $list;
    }
924944
public function getQueryableProperties()
    {
        $classMetadata = $this->getObjectManager()
                              ->getClassMetadata($this->getEntityClass());

        $fields = $classMetadata->getFieldNames();
        $alias  = $this->getEntityClassAlias();

        foreach ($fields as $key => &$field) {
            $fieldType = $classMetadata->getTypeOfField($field);
            if (!in_array($fieldType, array('string', 'text'))) {
                unset($fields[$key]);
            } else {
                $field = $alias . '.' . $field;
            }
        }

        return $fields;
    }
254656
protected static function define_properties() : array {
        return array(
                'fieldid'        => [
                        'type' => PARAM_INT,
                        'optional' => false,
                        'null'     => NULL_NOT_ALLOWED
                ],
                'instanceid'       => [
                        'type' => PARAM_INT,
                        'optional' => false,
                        'null'     => NULL_NOT_ALLOWED
                ],
                'intvalue'       => [
                        'type'     => PARAM_INT,
                        'optional' => true,
                        'default'  => null,
                        'null'     => NULL_ALLOWED
                ],
                'decvalue'       => [
                        'type'     => PARAM_FLOAT,
                        'optional' => true,
                        'default'  => null,
                        'null'     => NULL_ALLOWED
                ],
                'charvalue'      => [
                        'type'     => PARAM_TEXT,
                        'optional' => true,
                        'default'  => null,
                        'null'     => NULL_ALLOWED
                ],
                'shortcharvalue' => [
                        'type'     => PARAM_TEXT,
                        'optional' => true,
                        'default'  => null,
                        'null'     => NULL_ALLOWED
                ],
                // Mandatory field.
                'value'          => [
                        'type'    => PARAM_RAW,
                        'null'    => NULL_NOT_ALLOWED,
                        'default' => ''
                ],
                // Mandatory field.
                'valueformat'    => [
                        'type'    => PARAM_INT,
                        'null'    => NULL_NOT_ALLOWED,
                        'default' => FORMAT_MOODLE,
                        'optional' => true
                ],
                'contextid'      => [
                        'type'     => PARAM_INT,
                        'optional' => false,
                        'null'     => NULL_NOT_ALLOWED
                ]
        );
    }
146582
public function serialize_properties()
    {
        if (!empty($this->serialized_properties)) {
            return $this->serialized_properties;
        }

        $shift = 15;
        $flag_bits = 0;
        $flags = array();
        $raw_bytes = new AMQPWriter();

        foreach ($this->prop_types as $key => $prototype) {
            $val = isset($this->properties[$key]) ? $this->properties[$key] : null;

            // Very important: PHP type eval is weak, use the === to test the
            // value content. Zero or false value should not be removed
            if ($val === null) {
                $shift -= 1;
                continue;
            }

            if ($shift === 0) {
                $flags[] = $flag_bits;
                $flag_bits = 0;
                $shift = 15;
            }

            $flag_bits |= (1 << $shift);
            if ($prototype != 'bit') {
                $raw_bytes->{'write_' . $prototype}($val);
            }

            $shift -= 1;
        }

        $flags[] = $flag_bits;
        $result = new AMQPWriter();
        foreach ($flags as $flag_bits) {
            $result->write_short($flag_bits);
        }

        $result->write($raw_bytes->getvalue());

        $this->serialized_properties = $result->getvalue();

        return $this->serialized_properties;
    }
1137221
protected function getArray()
    {
        $key         = $this->getRangeKey()->getPropertyMetadata()->name;
        $array       = parent::getArray();
        $array[$key] = $this->getRangeValue();

        return $array;
    }