newInstance() : $rc->newInstanceArgs( $args ); } /** * Static method to instantiate a new instance of a class (shorthand of * 'instantiate'). * * This method performs exactly the same actions as the 'instantiate' * static method, but is simply shorter and easier to type! * @return \DataTables\Editor|\DataTables\Editor\Field|\DataTables\Editor\Join|\DataTables\Editor\Upload class * @static */ public static function inst () { $rc = new \ReflectionClass( get_called_class() ); $args = func_get_args(); return count( $args ) === 0 ? $rc->newInstance() : $rc->newInstanceArgs( $args ); } /** * Common getter / setter function for DataTables classes. * * This getter / setter method makes building getter / setting methods * easier, by abstracting everything to a single function call. * @param mixed &$prop The property to set * @param mixed $val The value to set - if given as null, then we assume * that the function is being used as a getter. * @param boolean $array Treat the target property as an array or not * (default false). If used as an array, then values passed in are added * to the $prop array. * @return self|mixed Class instance if setting (allowing chaining), or * the value requested if getting. */ protected function _getSet( &$prop, $val, $array=false ) { // Get if ( $val === null ) { return $prop; } // Set if ( $array ) { // Property is an array, merge or add to array is_array( $val ) ? $prop = array_merge( $prop, $val ) : $prop[] = $val; } else { // Property is just a value $prop = $val; } return $this; } /** * Determine if a property is available in a data set (allowing `null` to be * a valid value) * @param string $name Javascript dotted object name to write to * @param array $data Data source array to read from * @return boolean true if present, false otherwise * @private */ protected function _propExists ( $name, $data ) { if ( strpos($name, '.') === false ) { return isset( $data[ $name ] ); } $names = explode( '.', $name ); $inner = $data; for ( $i=0 ; $i