Skip to content

Commit 194bbbd

Browse files
committed
PHPC-311: Rename from/toArray() functions to from/toPHP()
1 parent 965f8c3 commit 194bbbd

24 files changed

+65
-65
lines changed

php_bson.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ PHONGO_API void zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *
7272
PHONGO_API int bson_to_zval(const unsigned char *data, int data_len, php_phongo_bson_state *state);
7373
PHONGO_API void php_phongo_bson_typemap_to_state(zval *typemap, php_phongo_bson_typemap *map TSRMLS_DC);
7474

75-
PHP_FUNCTION(toArray);
76-
PHP_FUNCTION(fromArray);
75+
PHP_FUNCTION(toPHP);
76+
PHP_FUNCTION(fromPHP);
7777
PHP_FUNCTION(toJSON);
7878
PHP_FUNCTION(fromJSON);
7979

php_phongo.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,11 +2075,11 @@ PHP_MINFO_FUNCTION(mongodb)
20752075

20762076
/* {{{ mongodb_functions[]
20772077
*/
2078-
ZEND_BEGIN_ARG_INFO_EX(ai_bson_fromArray, 0, 0, 1)
2079-
ZEND_ARG_INFO(0, array)
2078+
ZEND_BEGIN_ARG_INFO_EX(ai_bson_fromPHP, 0, 0, 1)
2079+
ZEND_ARG_INFO(0, value)
20802080
ZEND_END_ARG_INFO();
20812081

2082-
ZEND_BEGIN_ARG_INFO_EX(ai_bson_toArray, 0, 0, 1)
2082+
ZEND_BEGIN_ARG_INFO_EX(ai_bson_toPHP, 0, 0, 1)
20832083
ZEND_ARG_INFO(0, bson)
20842084
ZEND_END_ARG_INFO();
20852085

@@ -2092,8 +2092,8 @@ ZEND_BEGIN_ARG_INFO_EX(ai_bson_fromJSON, 0, 0, 1)
20922092
ZEND_END_ARG_INFO();
20932093

20942094
const zend_function_entry mongodb_functions[] = {
2095-
ZEND_NS_FE(BSON_NAMESPACE, fromArray, ai_bson_fromArray)
2096-
ZEND_NS_FE(BSON_NAMESPACE, toArray, ai_bson_toArray)
2095+
ZEND_NS_FE(BSON_NAMESPACE, fromPHP, ai_bson_fromPHP)
2096+
ZEND_NS_FE(BSON_NAMESPACE, toPHP, ai_bson_toPHP)
20972097
ZEND_NS_FE(BSON_NAMESPACE, toJSON, ai_bson_toJSON)
20982098
ZEND_NS_FE(BSON_NAMESPACE, fromJSON, ai_bson_fromJSON)
20992099
PHP_FE_END

src/bson.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -943,9 +943,9 @@ int bson_to_zval(const unsigned char *data, int data_len, php_phongo_bson_state
943943
return 1;
944944
}
945945

946-
/* {{{ proto string BSON\fromArray(array|object data)
947-
Returns the BSON representation of a value */
948-
PHP_FUNCTION(fromArray)
946+
/* {{{ proto string BSON\fromPHP(array|object $value)
947+
Returns the BSON representation of a PHP value */
948+
PHP_FUNCTION(fromPHP)
949949
{
950950
zval *data;
951951
bson_t *bson;
@@ -1029,9 +1029,9 @@ void php_phongo_bson_typemap_to_state(zval *typemap, php_phongo_bson_typemap *ma
10291029
}
10301030
}
10311031
}
1032-
/* {{{ proto string BSON\toArray(string data [, array $typemap = array()])
1033-
Returns the PHP representation of a BSON value, optionally converting them into custom types/classes */
1034-
PHP_FUNCTION(toArray)
1032+
/* {{{ proto array|object BSON\toPHP(string $bson [, array $typemap = array()])
1033+
Returns the PHP representation of a BSON value, optionally converting it into a custom class */
1034+
PHP_FUNCTION(toPHP)
10351035
{
10361036
char *data;
10371037
int data_len;

tests/bson/bson-binary-001.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ throws(function() use($classname) {
3333

3434

3535
foreach($tests as $n => $test) {
36-
$s = fromArray($test);
36+
$s = fromPHP($test);
3737
echo "Test#{$n} ", $json = toJSON($s), "\n";
3838
$bson = fromJSON($json);
39-
$testagain = toArray($bson);
40-
var_dump(toJSON(fromArray($test)), toJSON(fromArray($testagain)));
39+
$testagain = toPHP($bson);
40+
var_dump(toJSON(fromPHP($test)), toJSON(fromPHP($testagain)));
4141
var_dump((object)$test == (object)$testagain);
4242
}
4343

tests/bson/bson-decode-001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ $tests = array(
4141
);
4242

4343
foreach($tests as $n => $test) {
44-
$s = fromArray($test);
44+
$s = fromPHP($test);
4545
echo "Test#{$n} ", toJSON($s), "\n";
46-
$val = toArray($s);
46+
$val = toPHP($s);
4747
if ($val == (object) $test) {
4848
echo "OK\n";
4949
} else {

tests/bson/bson-decode-002.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ $tests = array(
2323
);
2424

2525
foreach($tests as $n => $test) {
26-
$s = BSON\fromArray($test);
26+
$s = BSON\fromPHP($test);
2727
echo "Test#{$n} ", BSON\toJSON($s), "\n";
28-
$val = BSON\toArray($s, array("root"=> "MyArrayObject", "document"=> "MyArrayObject", "array" => "MyArrayObject"));
28+
$val = BSON\toPHP($s, array("root"=> "MyArrayObject", "document"=> "MyArrayObject", "array" => "MyArrayObject"));
2929
var_dump($val);
3030
}
3131
?>

tests/bson/bson-encode-001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $tests = array(
3535
);
3636

3737
foreach($tests as $n => $test) {
38-
$s = fromArray($test);
38+
$s = fromPHP($test);
3939
echo "Test#{$n} ", toJSON($s), "\n";
4040
hex_dump($s);
4141
}

tests/bson/bson-encode-002.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,38 @@ class NumericArray implements BSON\Serializable, BSON\Unserializable
3636
}
3737

3838
echo "Testing top-level AssociativeArray:\n";
39-
$bson = BSON\fromArray(new AssociativeArray);
39+
$bson = BSON\fromPHP(new AssociativeArray);
4040
echo BSON\toJSON($bson), "\n";
4141
echo "Encoded BSON:\n";
4242
hex_dump($bson);
43-
$value = BSON\toArray($bson, array("root" => 'AssociativeArray'));
43+
$value = BSON\toPHP($bson, array("root" => 'AssociativeArray'));
4444
echo "Decoded BSON:\n";
4545
var_dump($value);
4646

4747
echo "\nTesting embedded AssociativeArray:\n";
48-
$bson = BSON\fromArray(array('embed' => new AssociativeArray));
48+
$bson = BSON\fromPHP(array('embed' => new AssociativeArray));
4949
echo BSON\toJSON($bson), "\n";
5050
echo "Encoded BSON:\n";
5151
hex_dump($bson);
52-
$value = BSON\toArray($bson, array("document" => 'AssociativeArray'));
52+
$value = BSON\toPHP($bson, array("document" => 'AssociativeArray'));
5353
echo "Decoded BSON:\n";
5454
var_dump($value);
5555

5656
echo "\nTesting top-level NumericArray:\n";
57-
$bson = BSON\fromArray(new NumericArray);
57+
$bson = BSON\fromPHP(new NumericArray);
5858
echo BSON\toJSON($bson), "\n";
5959
echo "Encoded BSON:\n";
6060
hex_dump($bson);
61-
$value = BSON\toArray($bson, array("root" => 'NumericArray'));
61+
$value = BSON\toPHP($bson, array("root" => 'NumericArray'));
6262
echo "Decoded BSON:\n";
6363
var_dump($value);
6464

6565
echo "\nTesting embedded NumericArray:\n";
66-
$bson = BSON\fromArray(array('embed' => new NumericArray));
66+
$bson = BSON\fromPHP(array('embed' => new NumericArray));
6767
echo BSON\toJSON($bson), "\n";
6868
echo "Encoded BSON:\n";
6969
hex_dump($bson);
70-
$value = BSON\toArray($bson, array("document" => 'NumericArray'));
70+
$value = BSON\toPHP($bson, array("document" => 'NumericArray'));
7171
echo "Decoded BSON:\n";
7272
var_dump($value);
7373

tests/bson/bson-encode-003.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ $tests = array(
3737
);
3838

3939
foreach($tests as $n => $test) {
40-
$s = fromArray($test);
40+
$s = fromPHP($test);
4141
echo "Test#{$n} ", toJSON($s), "\n";
4242
hex_dump($s);
43-
$ret = toArray($s);
43+
$ret = toPHP($s);
4444
var_dump($ret);
4545
}
4646
?>

tests/bson/bson-encode-004.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ $hannes->addFriend($mikola);
2222

2323
var_dump($hannes);
2424

25-
$s = fromArray(array($hannes));
25+
$s = fromPHP(array($hannes));
2626
echo "Test ", toJSON($s), "\n";
2727
hex_dump($s);
28-
$ret = toArray($s);
28+
$ret = toPHP($s);
2929
var_dump($ret);
3030
?>
3131
===DONE===

0 commit comments

Comments
 (0)