API16

API16:JRules/ toString

From Joomla! Documentation

Revision as of 22:34, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Magic method to convert the object to JSON string representation. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JRules/__toString...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Magic method to convert the object to JSON string representation.

[Edit Descripton]

Template:Description:JRules/ toString

Syntax

__toString()


Returns

string

Defined in

libraries/joomla/access/rules.php

Importing

jimport( 'joomla.access.rules' );

Source Body

public function __toString()
{
        $temp = array();
        foreach ($this->_data as $name => $rule)
        {
                // Convert the action to JSON, then back into an array otherwise
                // re-encoding will quote the JSON for the identities in the action.
                $temp[$name] = json_decode((string) $rule);
        }
        return json_encode($temp);
}

[Edit See Also] Template:SeeAlso:JRules/ toString

Examples

<CodeExamplesForm />