composer update

This commit is contained in:
2020-12-06 10:28:55 +00:00
parent 69d92960d9
commit 09413522bb
1596 changed files with 60456 additions and 39587 deletions
@@ -1 +0,0 @@
vendor/
+8 -4
View File
@@ -24,8 +24,8 @@ Suppose you need to pass a callback to a JSON object.
];
?>
<scrtip>
let bar = <?php echo $json_encode($array); ?>
<script>
let bar = <?php echo json_encode($array); ?>;
bar.callback('hello'); //error
</script>
```
@@ -52,8 +52,8 @@ To get around this problem, use `Raw` objects provided by this package:
];
?>
<scrtip>
let bar = <?php echo Encoder::encode($array); ?>
<script>
let bar = <?php echo Encoder::encode($array); ?>;
bar.callback('hello'); //prints hello
</script>
```
@@ -100,3 +100,7 @@ Result:
## License
This package is licensed under GPLv3.
## Download statistics
[![statistics](https://packagist-statistics.dura.hu/balping/json-raw-encoder/10days.svg)](https://packagist-statistics.dura.hu/balping/json-raw-encoder/10days.svg)
-1474
View File
File diff suppressed because it is too large Load Diff
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
@@ -1,58 +0,0 @@
<?php
/*
Json Raw Encoder
Encode arrays to json with raw JS objects (eg. callbacks) in them
Copyright (C) 2018 Balázs Dura-Kovács
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Balping\JsonRaw\Tests;
use Balping\JsonRaw\Raw;
use Balping\JsonRaw\Encoder;
use PHPUnit\Framework\TestCase;
class RawEncoderTest extends TestCase {
/** @test */
public function callbacks_can_be_passed(){
$array = [
"a" => "string",
"b" => 42,
"callback" => new Raw(<<<'JS'
function(a){
console.log(a);
}
JS
)
];
$json = Encoder::encode($array);
$this->assertEquals(<<<'JSON'
{"a":"string","b":42,"callback":function(a){
console.log(a);
}}
JSON
, $json);
}
}
-63
View File
@@ -1,63 +0,0 @@
<?php
/*
Json Raw Encoder
Encode arrays to json with raw JS objects (eg. callbacks) in them
Copyright (C) 2018 Balázs Dura-Kovács
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Balping\JsonRaw\Tests;
use Balping\JsonRaw\Raw;
use Balping\JsonRaw\Replacer;
use PHPUnit\Framework\TestCase;
class ReplacerTest extends TestCase {
/** @test */
public function callbacks_can_be_passed(){
$jsObjects = [];
$array = [
"a" => "string",
"b" => 42,
"callback" => $jsObjects[] = new Raw(<<<'JS'
function(a){
console.log(a);
}
JS
)
];
// imagine this being a vendor function in library
$json = json_encode($array);
$json = Replacer::replace($json, $jsObjects);
$this->assertEquals(<<<'JSON'
{"a":"string","b":42,"callback":function(a){
console.log(a);
}}
JSON
, $json);
}
}