Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\View\Compilers\Concerns;
4
 
5
trait CompilesJson
6
{
7
    /**
8
     * The default JSON encoding options.
9
     *
10
     * @var int
11
     */
12
    private $encodingOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT;
13
 
14
    /**
15
     * Compile the JSON statement into valid PHP.
16
     *
17
     * @param  string  $expression
18
     * @return string
19
     */
20
    protected function compileJson($expression)
21
    {
22
        $parts = explode(',', $this->stripParentheses($expression));
23
 
24
        $options = isset($parts[1]) ? trim($parts[1]) : $this->encodingOptions;
25
 
26
        $depth = isset($parts[2]) ? trim($parts[2]) : 512;
27
 
28
        return "<?php echo json_encode($parts[0], $options, $depth) ?>";
29
    }
30
}