Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
generate-complex-datatypes.php File Reference

Go to the source code of this file.

Functions

foreach($schema['objects'] as $obj_name=> $params) reorderParams (Array $input)
 
 makeConstructorParams (Array &$input)
 
 makeProperties (Array $input)
 
 makeConstructorContent (Array $input)
 
 makeSetFunctions (array $input)
 
 makeTypeArrayBody (Array $input)
 
 makeToArrayBody (Array $input)
 

Variables

const TARGET_PATH __DIR__ . '/../src/DataType'
 
 $scriptName = 'scripts/'. basename(__FILE__)
 
 $shouldWriteToDisc = (isset($GLOBALS['argv'][1]) && $GLOBALS['argv'][1] === '--no-file-generation') ? false : true
 
 $file_header
 
 $schema = getSchema()
 
 $limit = 100
 

Detailed Description

Generates interface Web3Methods.

Generating from resources/ethjs-schema.json -> objects.

Definition in file generate-complex-datatypes.php.

Function Documentation

◆ makeConstructorContent()

makeConstructorContent ( Array  $input)

Create constructor content.

Parameters
array$input- ['params' => ['name'=> Type, 'name'=> Type ...], 'required' => ['name', 'name' ...] ]
Returns
bool|string

Definition at line 247 of file generate-complex-datatypes.php.

◆ makeConstructorParams()

makeConstructorParams ( Array &  $input)

Create constructor parameters.

Parameters
array$input- ['params' => ['name'=> Type, 'name'=> Type ...], 'required' => ['name', 'name' ...] ]
Returns
array Array of PhpParameter.

Definition at line 181 of file generate-complex-datatypes.php.

◆ makeProperties()

makeProperties ( Array  $input)

Create properties.

Parameters
array$input- ['params' => ['name'=> Type, 'name'=> Type ...], 'required' => ['name', 'name' ...] ]
Returns
array

Definition at line 225 of file generate-complex-datatypes.php.

◆ makeSetFunctions()

makeSetFunctions ( array  $input)

Create set_<PROPERTY> functions content.

Parameters
array$input['params' => ['name'=> Type, 'name'=> Type ...], 'required' => ['name', 'name' ...] ]
Returns
array
Exceptions
Exception

Definition at line 268 of file generate-complex-datatypes.php.

◆ makeToArrayBody()

makeToArrayBody ( Array  $input)

Create return array.

Parameters
array$input- ['params' => ['name'=> Type, 'name'=> Type ...], 'required' => ['name', 'name' ...] ]
Returns
string

Definition at line 332 of file generate-complex-datatypes.php.

◆ makeTypeArrayBody()

makeTypeArrayBody ( Array  $input)

Create Constructor from array.

Parameters
array$input['params' => ['name'=> Type, 'name'=> Type ...], 'required' => ['name', 'name' ...] ]
Returns
string

Definition at line 309 of file generate-complex-datatypes.php.

◆ reorderParams()

foreach ( $schema[ 'objects'] as $obj_name=> $params) reorderParams ( Array  $input)

Reorder parameters.

Prioritizing required params over unrequired ones.

Parameters
array$inputParameter array.
Returns
array Parameter array.

Definition at line 151 of file generate-complex-datatypes.php.

Variable Documentation

◆ $file_header

$file_header
Initial value:
= <<<EOF
<?php
EOF

Definition at line 42 of file generate-complex-datatypes.php.

◆ $limit

$limit = 100

Definition at line 58 of file generate-complex-datatypes.php.

◆ $schema

$schema = getSchema()

Definition at line 56 of file generate-complex-datatypes.php.

Referenced by EthDataType\getAllTypeClasses().

◆ $scriptName

$scriptName = 'scripts/'. basename(__FILE__)

Definition at line 32 of file generate-complex-datatypes.php.

◆ $shouldWriteToDisc

$shouldWriteToDisc = (isset($GLOBALS['argv'][1]) && $GLOBALS['argv'][1] === '--no-file-generation') ? false : true

Definition at line 35 of file generate-complex-datatypes.php.

◆ TARGET_PATH

const TARGET_PATH __DIR__ . '/../src/DataType'

Definition at line 27 of file generate-complex-datatypes.php.