Automatic pass to convert with php-cs-fixer
This commit is contained in:
@@ -1,56 +1,72 @@
|
||||
<?php
|
||||
|
||||
/** DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
/**
|
||||
* DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework;
|
||||
|
||||
/** The graphStyleLine : draw a graph with lines */
|
||||
/**
|
||||
* The graphStyleLine : draw a graph with lines
|
||||
*/
|
||||
class GraphStyleLinePoints
|
||||
{
|
||||
/** The line color. To hide the lines, choose "transparent"
|
||||
*/
|
||||
/**
|
||||
* The line color. To hide the lines, choose "transparent"
|
||||
*/
|
||||
protected $lineColor;
|
||||
|
||||
/** The point color background. To hide the points, choose "transparent"
|
||||
*/
|
||||
/**
|
||||
* The point color background. To hide the points, choose "transparent"
|
||||
*/
|
||||
protected $pointBgcolor;
|
||||
|
||||
/** The point color border
|
||||
*/
|
||||
/**
|
||||
* The point color border
|
||||
*/
|
||||
protected $pointColor;
|
||||
|
||||
/** The point shape (square, circle, triangle, lozenge)
|
||||
*/
|
||||
/**
|
||||
* The point shape (square, circle, triangle, lozenge)
|
||||
*/
|
||||
protected $pointShape;
|
||||
|
||||
/** The point width in pixel
|
||||
*/
|
||||
/**
|
||||
* The point width in pixel
|
||||
*/
|
||||
protected $pointWidth;
|
||||
|
||||
/** The number of the colors/shapes to use
|
||||
*/
|
||||
/**
|
||||
* The number of the colors/shapes to use
|
||||
*/
|
||||
protected $number;
|
||||
|
||||
/** The allowed shapes */
|
||||
protected $allowedShapes = array("square", "circle", "triangle", "lozenge");
|
||||
/**
|
||||
* The allowed shapes
|
||||
*/
|
||||
protected $allowedShapes = ["square", "circle", "triangle", "lozenge"];
|
||||
|
||||
/** The palette to use */
|
||||
/**
|
||||
* The palette to use
|
||||
*/
|
||||
protected $palette;
|
||||
|
||||
/** Return the name of the style */
|
||||
/**
|
||||
* Return the name of the style
|
||||
*/
|
||||
public function name()
|
||||
{
|
||||
return "lineAndPoints";
|
||||
}
|
||||
|
||||
/** Set the line color if the parameter is provided.
|
||||
* Get the line color if the parameter is not provided
|
||||
* @param string|null $lineColor The line color
|
||||
*/
|
||||
/**
|
||||
* Set the line color if the parameter is provided.
|
||||
* Get the line color if the parameter is not provided
|
||||
* @param string|null $lineColor The line color
|
||||
*/
|
||||
public function lineColor($lineColor = null)
|
||||
{
|
||||
if ($lineColor === null) {
|
||||
@@ -59,7 +75,7 @@ class GraphStyleLinePoints
|
||||
if (
|
||||
! is_string($lineColor) ||
|
||||
($lineColor !== "transparent" &&
|
||||
! in_array($lineColor, Color::colorList()))
|
||||
! in_array($lineColor, Color::colorList(), true))
|
||||
) {
|
||||
throw new \Exception(dgettext(
|
||||
"domframework",
|
||||
@@ -70,10 +86,11 @@ class GraphStyleLinePoints
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Set the palette to use if the parameter is provided
|
||||
* Get the palette if the parameter is not provided
|
||||
* @param string|null $palette The palette to use
|
||||
*/
|
||||
/**
|
||||
* Set the palette to use if the parameter is provided
|
||||
* Get the palette if the parameter is not provided
|
||||
* @param string|null $palette The palette to use
|
||||
*/
|
||||
public function palette($palette = null)
|
||||
{
|
||||
if ($palette === null) {
|
||||
@@ -89,10 +106,11 @@ class GraphStyleLinePoints
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Set the point background color if the parameter is provided.
|
||||
* Get the point background color if the parameter is not provided
|
||||
* @param string|null $pointBgcolor The point background color
|
||||
*/
|
||||
/**
|
||||
* Set the point background color if the parameter is provided.
|
||||
* Get the point background color if the parameter is not provided
|
||||
* @param string|null $pointBgcolor The point background color
|
||||
*/
|
||||
public function pointBgcolor($pointBgcolor = null)
|
||||
{
|
||||
if ($pointBgcolor === null) {
|
||||
@@ -101,7 +119,7 @@ class GraphStyleLinePoints
|
||||
if (
|
||||
! is_string($pointBgcolor) ||
|
||||
($pointBgcolor !== "transparent" &&
|
||||
! in_array($pointBgcolor, Color::colorList()))
|
||||
! in_array($pointBgcolor, Color::colorList(), true))
|
||||
) {
|
||||
throw new \Exception(dgettext(
|
||||
"domframework",
|
||||
@@ -112,10 +130,11 @@ class GraphStyleLinePoints
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Set the point border color if the parameter is provided.
|
||||
* Get the point border color if the parameter is not provided
|
||||
* @param string|null $pointColor The point border color
|
||||
*/
|
||||
/**
|
||||
* Set the point border color if the parameter is provided.
|
||||
* Get the point border color if the parameter is not provided
|
||||
* @param string|null $pointColor The point border color
|
||||
*/
|
||||
public function pointColor($pointColor = null)
|
||||
{
|
||||
if ($pointColor === null) {
|
||||
@@ -124,7 +143,7 @@ class GraphStyleLinePoints
|
||||
if (
|
||||
! is_string($pointColor) ||
|
||||
($pointColor !== "transparent" &&
|
||||
! in_array($pointColor, Color::colorList()))
|
||||
! in_array($pointColor, Color::colorList(), true))
|
||||
) {
|
||||
throw new \Exception(dgettext(
|
||||
"domframework",
|
||||
@@ -135,10 +154,11 @@ class GraphStyleLinePoints
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Set the point shape if the parameter is provided.
|
||||
* Get the point shape if the parameter is not provided
|
||||
* @param string|null $pointShape The point shape
|
||||
*/
|
||||
/**
|
||||
* Set the point shape if the parameter is provided.
|
||||
* Get the point shape if the parameter is not provided
|
||||
* @param string|null $pointShape The point shape
|
||||
*/
|
||||
public function pointShape($pointShape = null)
|
||||
{
|
||||
if ($pointShape === null) {
|
||||
@@ -146,7 +166,7 @@ class GraphStyleLinePoints
|
||||
}
|
||||
if (
|
||||
! is_string($pointShape) ||
|
||||
! in_array($pointShape, $this->allowedShapes)
|
||||
! in_array($pointShape, $this->allowedShapes, true)
|
||||
) {
|
||||
throw new \Exception(dgettext(
|
||||
"domframework",
|
||||
@@ -157,10 +177,11 @@ class GraphStyleLinePoints
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Set the point width if the parameter is provided.
|
||||
* Get the point width if the parameter is not provided
|
||||
* @param string|null $pointWidth The point width
|
||||
*/
|
||||
/**
|
||||
* Set the point width if the parameter is provided.
|
||||
* Get the point width if the parameter is not provided
|
||||
* @param string|null $pointWidth The point width
|
||||
*/
|
||||
public function pointWidth($pointWidth = null)
|
||||
{
|
||||
if ($pointWidth === null) {
|
||||
@@ -176,11 +197,12 @@ class GraphStyleLinePoints
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Select the colors, shapes by the serie number.
|
||||
* Do not change any property if the property is already defined
|
||||
* If the parameter is not provided, return the value
|
||||
* @param integer|null $number The serie number
|
||||
*/
|
||||
/**
|
||||
* Select the colors, shapes by the serie number.
|
||||
* Do not change any property if the property is already defined
|
||||
* If the parameter is not provided, return the value
|
||||
* @param integer|null $number The serie number
|
||||
*/
|
||||
public function number($number = null)
|
||||
{
|
||||
if ($number === null) {
|
||||
@@ -209,14 +231,15 @@ class GraphStyleLinePoints
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw in the $gd resource, in the $free array, the data with the parameter
|
||||
* of the style
|
||||
* @param resource $gd The resource to modify
|
||||
* @param array $free The free space coordinates on the graphic
|
||||
* @param array $data The data to graph
|
||||
* @param object $axisX The X axis used to graph
|
||||
* @param object $axisY The Y axis used to graph
|
||||
*/
|
||||
/**
|
||||
* Draw in the $gd resource, in the $free array, the data with the parameter
|
||||
* of the style
|
||||
* @param resource $gd The resource to modify
|
||||
* @param array $free The free space coordinates on the graphic
|
||||
* @param array $data The data to graph
|
||||
* @param object $axisX The X axis used to graph
|
||||
* @param object $axisY The Y axis used to graph
|
||||
*/
|
||||
public function draw($gd, $free, $data, $axisX, $axisY)
|
||||
{
|
||||
if ($this->lineColor !== "transparent") {
|
||||
@@ -261,11 +284,12 @@ class GraphStyleLinePoints
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw a point defined in the property of the class
|
||||
* @param resource $gd The resource to modify
|
||||
* @param integer $posX The X position to draw the point
|
||||
* @param integer $posY The Y position to draw the point
|
||||
*/
|
||||
/**
|
||||
* Draw a point defined in the property of the class
|
||||
* @param resource $gd The resource to modify
|
||||
* @param integer $posX The X position to draw the point
|
||||
* @param integer $posY The Y position to draw the point
|
||||
*/
|
||||
private function drawPoint($gd, $posX, $posY)
|
||||
{
|
||||
if ($this->pointColor !== "transparent") {
|
||||
@@ -302,10 +326,10 @@ class GraphStyleLinePoints
|
||||
if ($this->pointBgcolor !== "transparent") {
|
||||
imagefilledpolygon(
|
||||
$gd,
|
||||
array($posX - $half - 2, $posY,
|
||||
[$posX - $half - 2, $posY,
|
||||
$posX, $posY - $half - 2,
|
||||
$posX + $half + 2, $posY,
|
||||
$posX, $posY + $half + 2),
|
||||
$posX, $posY + $half + 2],
|
||||
4,
|
||||
$pointBgcolor
|
||||
);
|
||||
@@ -313,10 +337,10 @@ class GraphStyleLinePoints
|
||||
if ($this->pointColor !== "transparent") {
|
||||
imagepolygon(
|
||||
$gd,
|
||||
array($posX - $half - 2, $posY,
|
||||
[$posX - $half - 2, $posY,
|
||||
$posX, $posY - $half - 2,
|
||||
$posX + $half + 2, $posY,
|
||||
$posX, $posY + $half + 2),
|
||||
$posX, $posY + $half + 2],
|
||||
4,
|
||||
$pointColor
|
||||
);
|
||||
@@ -348,9 +372,9 @@ class GraphStyleLinePoints
|
||||
if ($this->pointBgcolor !== "transparent") {
|
||||
imagefilledpolygon(
|
||||
$gd,
|
||||
array($posX - $half - 2, $posY + $half + 2,
|
||||
[$posX - $half - 2, $posY + $half + 2,
|
||||
$posX, $posY - $half - 2,
|
||||
$posX + $half + 2, $posY + $half + 2),
|
||||
$posX + $half + 2, $posY + $half + 2],
|
||||
3,
|
||||
$pointBgcolor
|
||||
);
|
||||
@@ -358,9 +382,9 @@ class GraphStyleLinePoints
|
||||
if ($this->pointColor !== "transparent") {
|
||||
imagepolygon(
|
||||
$gd,
|
||||
array($posX - $half - 2, $posY + $half + 2,
|
||||
[$posX - $half - 2, $posY + $half + 2,
|
||||
$posX, $posY - $half - 2,
|
||||
$posX + $half + 2, $posY + $half + 2),
|
||||
$posX + $half + 2, $posY + $half + 2],
|
||||
3,
|
||||
$pointColor
|
||||
);
|
||||
@@ -374,11 +398,12 @@ class GraphStyleLinePoints
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw a sample of the style for the legend
|
||||
* @param resource $gd The resource to modify
|
||||
* @param integer $x The central position of the sample in x
|
||||
* @param integer $y The central position of the sample in y
|
||||
*/
|
||||
/**
|
||||
* Draw a sample of the style for the legend
|
||||
* @param resource $gd The resource to modify
|
||||
* @param integer $x The central position of the sample in x
|
||||
* @param integer $y The central position of the sample in y
|
||||
*/
|
||||
public function sample($gd, $x, $y)
|
||||
{
|
||||
if ($this->lineColor !== "transparent") {
|
||||
|
||||
Reference in New Issue
Block a user