Creates a new JqplotDataGenerator instance for a graph type and view properties.

@param string $type 'pie', 'bar', or 'evolution'
@param array $properties The view properties.
@throws \Exception
@return JqplotDataGenerator
332899
public static function factory($type, $properties)
    {
        switch ($type) {
            case 'evolution':
                return new JqplotDataGenerator\Evolution($properties, $type);
            case 'pie':
            case 'bar':
                return new JqplotDataGenerator($properties, $type);
            default:
                throw new Exception("Unknown JqplotDataGenerator type '$type'.");
        }
    }
1184117
private function dateTypeBuilder(DateTimeTypeBase $type) : DateFieldBuilder
    {
        $this->type($type);

        return new DateFieldBuilder($type, $this);
    }
226980
public function getRatings(string $type = null): PaginatedResults
    {
        if ($type !== null) {
            if (Rating::isValidRatingType($type) === false) {
                throw new InvalidArgumentException('Invalid rating type');
            }
            $json = $this->parent->performAPICallWithJsonResponse(
                'get',
                '/user/ratings/query',
                ['query' => ['itemType' => $type]]
            );
        } else {
            $json = $this->parent->performAPICallWithJsonResponse('get', '/user/ratings');
        }

        return new PaginatedResults(DataParser::parseDataArray($json, Rating::class), $this->parent->getLastLinks());
    }
800410
protected function runProviders(array $providers, array $properties = array())
    {
        $data = array();

        foreach ($providers as $config) {
            if (is_string($config)) {
                $config = array($config);
            }

            $className = array_shift($config);

            if (isset(self::$config->providers[$className])) {
                $config = \CMap::mergeArray(self::$config->providers[$className], $config);
            } else {
                $config['class'] = $className;
            }

            if (!class_exists($config['class'])) {
                throw new Exception("Provider '{$config['class']}' does not exist.");
            }

            $class = new \ReflectionClass($config['class']);
            foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
                $name = $property->getName();

                if (!isset($config[$name]) && isset($properties[$name])) {
                    $config[$name] = $properties[$name];
                }
            }

            $provider = \Yii::createComponent($config);

            $data = array_merge($data, $provider->provide());
        }

        return $data;
    }
628319
public function addProperties($properties)
    {
        if (empty($properties) || !count((array)$properties)) {
            throw new \Exception('Empty properties given');
        }

        if (!is_array($properties) && !is_object($properties)) {
            throw new \Exception('Expected array or object');
        }

        foreach ($properties as $key => $property) {
            $this->addProperty($key, $property);
        }

        return $this;
    }
421514
public function setType( $type, $options = array(), $series = 'default' )
    {
        parent::setType( $type, $options, $series );
        if ( $series == 'default' ) {
            $rendererOptions = $this->types['default']->getRendererOptions();
            if ( $renderer = $this->types['default']->getRenderer() ) {
                $this->options['seriesDefaults']['renderer'] = $renderer;
            }
            if (! empty( $rendererOptions ) ) {
                $this->options['seriesDefaults']['rendererOptions'] = $rendererOptions;
            }
        }
        return $this;
    }
210361
public function generate($type)
    {
        return function ($row, $control, $templates = []) use ($type) {
            $data = $this->buildFieldByType($type, $row, $control);
            return $this->render($templates, $data);
        };
    }
756786
private function _renderBarChart($groupCount, $dimensions = '2d') {
		require_once('jpgraph_bar.php');

		$this->_renderCartesianPlotArea();

		for($i = 0; $i < $groupCount; ++$i) {
			$this->_renderPlotBar($i,$dimensions);
		}
	}
724718
private function makeItem($type, $properties = [], Closure $callback = null)
    {
        $properties = array_merge($properties, [
            'type' => $type,
            'root' => true,
        ]);

        $item = MenuItem::make($properties, $callback);
        $this->addItem($item);

        return $item;
    }
842026
public static function create($type, ClassMetadataBuilder $builder)
    {
        if (isset(static::$map[$type])) {
            return new static::$map[$type]($builder);
        }

        throw new InvalidArgumentException("Inheritance type [{$type}] does not exist. SINGLE_TABLE and JOINED are support");
    }
781577
protected function createResult(array &$data, $type = null) {
		if ($type === null) {
			$type = $this->getResultType();
		}

		if ($type & self::RESULT_ARRAY) {
			return $data;
		}

		if ($type & self::RESULT_OBJECT) {
			return (object) $data;
		}

		if ($type & self::RESULT_MODEL) {
			return $this->create($data);
		}

		throw new Exceptions\InvalidResultType('Nothing to do with the type #' . $type);
	}
445110
public function setType($type)
    {
        $this->type = $type;

        switch ($this->type) {
            case 'jdepend-chart':
            case 'jdepend-xml':
            case 'overview-pyramid':
            case 'phpunit-xml':
            case 'summary-xml':
                break;

            default:
                throw new BuildException('Logger "' . $this->type . '" not implemented');
        }
    }
280088
public function build($type)
    {
        if (!is_subclass_of($type, BaseSunat::class)) {
            throw new \Exception($type.' should be instance of '.BaseSunat::class);
        }

        /** @var $service BaseSunat */
        $service = new $type();
        $service->setClient($this->client);

        return $service;
    }
736096
public function from($type)
    {
        switch ($type) {
            case 'ini':
                $this->data = Ini::decode($this->string);
                break;

            case 'json':
                $this->data = Json::decode($this->string);
                break;

            case 'php':
                $this->data = Php::decode($this->string);
                break;

            case 'xml':
                $this->data = Xml::decode($this->string);
                break;

            case 'yml':
            case 'yaml':
                $this->data = Yaml::decode($this->string);
                break;
            
            default:
                throw new \Exception("Format not supported: " . $type);
        }

        return $this;
    }
1211865
public static function createObject($type, array $params = [])
    {
        if (is_string($type)) {
            return new $type;
        } elseif (is_array($type)) {
            $class = '\\PG\\I18N\\' . ($type['class'] ?? 'PhpMessageSource');
            unset($type['class']);
            $clazz = new $class;
            foreach ($type as $prop => $val) {
                $clazz->$prop = $val;
            }
            return $clazz;
        }

        throw new \Exception('Unsupported configuration type: ' . gettype($type));
    }
717879
public function setFilterRenderType($type)
    {
        $type = strtolower($type);
        if (!in_array($type, [Filter::RENDER_INNER, Filter::RENDER_OUTER])) {
            throw new Exception('Type must be Filter::RENDER_INNER or Filter::RENDER_OUTER.');
        }

        $this->filterRenderType = $type;
        return $this;
    }
631584
public static function createObject($type, array $params = [])
    {
        if (is_callable($type, true)) {
            return call_user_func($type, $params);
        }

        if (is_string($type) && class_exists($type)) {
            $object = new $type();
        } elseif (is_array($type) && isset($type['class'])) {
            $class = $type['class'];
            unset($type['class']);
            $reflection = new \ReflectionClass($class);
            $object = $reflection->newInstanceArgs($params);
        }

        if (!empty($object) && is_array($type)) {
            foreach ($type as $property => $value) {
                $object->$property = $value;
            }
            return $object;
        }

        throw new \Exception("Unsupported configuration type: " . gettype($type));
    }