Skip to content

Commit

Permalink
fixes call to classes without using their namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflabs committed May 9, 2018
1 parent 5626000 commit d00c23d
Show file tree
Hide file tree
Showing 35 changed files with 114 additions and 82 deletions.
4 changes: 2 additions & 2 deletions src/graph/AxisPrototype.php
Expand Up @@ -6,7 +6,7 @@

namespace Amenadiel\JpGraph\Graph;

use Amenadiel\JpGraph\Text\Text;
use Amenadiel\JpGraph\Text;
use Amenadiel\JpGraph\Util;

/**
Expand Down Expand Up @@ -56,7 +56,7 @@ public function __construct($img, $aScale, $color = [0, 0, 0])
$this->img = $img;
$this->scale = $aScale;
$this->color = $color;
$this->title = new Text('');
$this->title = new Text\Text('');

if ($aScale->type == 'y') {
$this->title_margin = 25;
Expand Down
2 changes: 1 addition & 1 deletion src/graph/GanttGraph.php
Expand Up @@ -783,7 +783,7 @@ public function Stroke($aStrokeFileName = '')

// Should we do any final image transformation
if ($this->iImgTrans) {
$tform = new Imae\ImgTrans($this->img->img);
$tform = new Image\ImgTrans($this->img->img);
$this->img->img = $tform->Skew3D(
$this->iImgTransHorizon,
$this->iImgTransSkewDist,
Expand Down
10 changes: 5 additions & 5 deletions src/graph/Graph.php
Expand Up @@ -361,7 +361,7 @@ public function Add($aPlot)
$cl = $aPlot;
}

if ($cl instanceof Text) {
if ($cl instanceof Text\Text) {
$this->AddText($aPlot);
} elseif (($cl instanceof Plot\PlotLine)) {
$this->AddLine($aPlot);
Expand Down Expand Up @@ -419,7 +419,7 @@ public function AddY2($aPlot)
$cl = $aPlot;
}

if ($cl instanceof Text) {
if ($cl instanceof Text\Text) {
$this->AddText($aPlot, true);
} elseif (($cl instanceof Plot\PlotLine)) {
$this->AddLine($aPlot, true);
Expand Down Expand Up @@ -450,7 +450,7 @@ public function AddY($aN, $aPlot)
if (($cl instanceof Text\Text) ||
($cl instanceof Plot\PlotLine) ||
($cl instanceof Plot\PlotBand)) {
JpGraph::RaiseL(25013); //('You can only add standard plots to multiple Y-axis');
Util\JpGraphError::RaiseL(25013); //('You can only add standard plots to multiple Y-axis');
} else {
$this->ynplots[$aN][] = $aPlot;
}
Expand Down Expand Up @@ -578,7 +578,7 @@ public function SetBackgroundImage($aFileName, $aBgType = BGIMG_FILLPLOT, $aImgF
// Get extension to determine image type
if ($aImgFormat == 'auto') {
$e = explode('.', $aFileName);
if (!$e) {
if (empty($e)) {
Util\JpGraphError::RaiseL(25018, $aFileName); //('Incorrect file name for Graph::SetBackgroundImage() : '.$aFileName.' Must have a valid image extension (jpg,gif,png) when using autodetection of image type');
}

Expand Down Expand Up @@ -996,7 +996,7 @@ public function StrokeCSIM($aScriptName = 'auto', $aCSIMName = '', $aBorder = 0)
{
if ($aCSIMName == '') {
// create a random map name
srand((float) microtime() * 1000000);
srand((integer) (microtime() * 1000000));
$r = rand(0, 100000);
$aCSIMName = '__mapname' . $r . '__';
}
Expand Down
5 changes: 2 additions & 3 deletions src/graph/Legend.php
Expand Up @@ -6,7 +6,6 @@

namespace Amenadiel\JpGraph\Graph;

use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
use Amenadiel\JpGraph\Util;

Expand Down Expand Up @@ -184,7 +183,7 @@ public function SetAbsPos($aX, $aY, $aHAlign = 'right', $aVAlign = 'top')
public function Pos($aX, $aY, $aHAlign = 'right', $aVAlign = 'top')
{
if (!($aX < 1 && $aY < 1)) {
JpGraphError::RaiseL(25120); //(" Position for legend must be given as percentage in range 0-1");
Util\JpGraphError::RaiseL(25120); //(" Position for legend must be given as percentage in range 0-1");
}
$this->xpos = $aX;
$this->ypos = $aY;
Expand Down Expand Up @@ -472,7 +471,7 @@ public function Stroke($aImg)
if ($p[3] < -100) {
// p[1][0] == iPattern, p[1][1] == iPatternColor, p[1][2] == iPatternDensity
if ($patternFactory == null) {
$patternFactory = new Graph\RectPatternFactory();
$patternFactory = new RectPatternFactory();
}
$prect = $patternFactory->Create($p[1][0], $p[1][1], 1);
$prect->SetBackground($p[1][3]);
Expand Down
3 changes: 2 additions & 1 deletion src/graph/PieGraph.php
Expand Up @@ -8,6 +8,7 @@

use Amenadiel\JpGraph\Image;
use Amenadiel\JpGraph\Plot;
use Amenadiel\JpGraph\Text;

/**
* @class PieGraph
Expand Down Expand Up @@ -48,7 +49,7 @@ public function Add($aObj)
$cl = $aObj;
}

if ($cl instanceof Text) {
if ($cl instanceof Text\Text) {
$this->AddText($aObj);
} elseif (($cl instanceof Plot\IconPlot)) {
$this->AddIcon($aObj);
Expand Down
3 changes: 2 additions & 1 deletion src/graph/PolarAxis.php
Expand Up @@ -6,6 +6,7 @@

namespace Amenadiel\JpGraph\Graph;

use Amenadiel\JpGraph\Text;
use Amenadiel\JpGraph\Util;

/**
Expand Down Expand Up @@ -208,7 +209,7 @@ public function StrokeAngleLabels($pos, $type)

$d = max($this->img->plotwidth, $this->img->plotheight) * 1.42;
$a = $this->angle_step;
$t = new Text();
$t = new Text\Text();
$t->SetColor($this->angle_fontcolor);
$t->SetFont($this->angle_fontfam, $this->angle_fontstyle, $this->angle_fontsize);
$xright = $this->img->width - $this->img->right_margin;
Expand Down
4 changes: 3 additions & 1 deletion src/graph/PolarLogScale.php
Expand Up @@ -15,7 +15,9 @@ public function __construct($aMax, $graph, $aClockwise = false)
{
parent::__construct(0, $aMax, 'x');
$this->graph = $graph;
$this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE);
if ($this->ticks instanceof LogTicks) {
$this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE);
}
$this->clockwise = $aClockwise;
}

Expand Down
4 changes: 3 additions & 1 deletion src/graph/RadarAxis.php
Expand Up @@ -6,6 +6,8 @@

namespace Amenadiel\JpGraph\Graph;

use Amenadiel\JpGraph\Text;

/**
* @class RadarAxis
* // Description: Implements axis for the radar graph
Expand All @@ -20,7 +22,7 @@ public function __construct($img, $aScale, $color = [0, 0, 0])
{
parent::__construct($img, $aScale, $color);
$this->len = $img->plotheight;
$this->title = new Text();
$this->title = new Text\Text();
$this->title->SetFont(FF_FONT1, FS_BOLD);
$this->color = [0, 0, 0];
}
Expand Down
7 changes: 4 additions & 3 deletions src/graph/RadarGraph.php
Expand Up @@ -6,8 +6,9 @@

namespace Amenadiel\JpGraph\Graph;

use Amenadiel\JpGraph\ImgTrans;
use Amenadiel\JpGraph\Image;
use Amenadiel\JpGraph\Plot;
use Amenadiel\JpGraph\Text;
use Amenadiel\JpGraph\Util;

/**
Expand Down Expand Up @@ -144,7 +145,7 @@ public function Add($aPlot)
$cl = $aPlot;
}

if ($cl instanceof Text) {
if ($cl instanceof Text\Text) {
$this->AddText($aPlot);
} elseif (($cl instanceof Plot\IconPlot)) {
$this->AddIcon($aPlot);
Expand Down Expand Up @@ -313,7 +314,7 @@ public function Stroke($aStrokeFileName = '')

// Should we do any final image transformation
if ($this->iImgTrans && !$_csim) {
$tform = new ImgTrans($this->img->img);
$tform = new Image\ImgTrans($this->img->img);
$this->img->img = $tform->Skew3D(
$this->iImgTransHorizon,
$this->iImgTransSkewDist,
Expand Down
4 changes: 2 additions & 2 deletions src/graph/RadarGrid.php
Expand Up @@ -14,7 +14,7 @@
* //
* // Copyright (c) Asial Corporation. All rights reserved.
*/
require_once 'jpgraph_plotmark.inc.php';
use Amenadiel\JpGraph\Plot;

/**
* @class RadarGrid
Expand Down Expand Up @@ -114,7 +114,7 @@ class RadarPlot
public function __construct($data)
{
$this->data = $data;
$this->mark = new PlotMark();
$this->mark = new Plot\PlotMark();
}

public function Min()
Expand Down
2 changes: 1 addition & 1 deletion src/image/DigitalLED74.php
Expand Up @@ -246,7 +246,7 @@ public function _GetLED($aLedIdx, $aColor = 0)
}
}

$img = new Image\Image($width, $height, DEFAULT_GFORMAT, false);
$img = new Image($width, $height, DEFAULT_GFORMAT, false);
$img->Copy($simg->img, 0, 0, 0, 0, $width, $height, $swidth, $sheight);
$simg->Destroy();
unset($simg);
Expand Down
6 changes: 3 additions & 3 deletions src/plot/AccBarPlot.php
Expand Up @@ -256,15 +256,15 @@ public function Stroke($img, $xscale, $yscale)
}
if (is_array($this->plots[$j]->grad_fromcolor)) {
// The first argument (grad_fromcolor) can be either an array or a single color. If it is an array
// then we have two choices. It can either a) be a single color specified as an RGB triple or it can be
// then we have two choices. It can either a) be a single color specified as an Image\RGB triple or it can be
// an array to specify both (from, to style) for each individual bar. The way to know the difference is
// to investgate the first element. If this element is an integer [0,255] then we assume it is an RGB
// to investgate the first element. If this element is an integer [0,255] then we assume it is an Image\RGB
// triple.
$ng = count($this->plots[$j]->grad_fromcolor);
if ($ng === 3) {
if (is_numeric($this->plots[$j]->grad_fromcolor[0]) && $this->plots[$j]->grad_fromcolor[0] > 0 &&
$this->plots[$j]->grad_fromcolor[0] < 256) {
// RGB Triple
// Image\RGB Triple
$fromcolor = $this->plots[$j]->grad_fromcolor;
$tocolor = $this->plots[$j]->grad_tocolor;
$style = $this->plots[$j]->grad_style;
Expand Down
2 changes: 2 additions & 0 deletions src/plot/AccLinePlot.php
Expand Up @@ -6,6 +6,8 @@

namespace Amenadiel\JpGraph\Plot;

use Amenadiel\JpGraph\Util;

/**
* @class AccLinePlot
* // Description:
Expand Down
12 changes: 6 additions & 6 deletions src/plot/BarPlot.php
Expand Up @@ -123,7 +123,7 @@ public function Legend($graph)
{
if ($this->grad && $this->legend != '' && !$this->fill) {
$color = [$this->grad_fromcolor, $this->grad_tocolor];
// In order to differentiate between gradients and cooors specified as an RGB triple
// In order to differentiate between gradients and cooors specified as an Image\RGB triple
$graph->legend->Add(
$this->legend,
$color,
Expand Down Expand Up @@ -275,7 +275,7 @@ public function SetNoFill()

public function SetFillColor($aColor)
{
// Do an extra error check if the color is specified as an RGB array triple
// Do an extra error check if the color is specified as an Image\RGB array triple
// In that case convert it to a hex string since it will otherwise be
// interpretated as an array of colors for each individual bar.

Expand Down Expand Up @@ -388,7 +388,7 @@ public function Stroke($img, $xscale, $yscale)
if (isset($this->coords[1])) {
if (count($this->coords[1]) != $numpoints) {
Util\JpGraphError::RaiseL(2003, count($this->coords[1]), $numpoints);
//"Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])."Number of Y-points:$numpoints");
//"Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])."Number of Y-points:$numpoints");
} else {
$exist_x = true;
}
Expand Down Expand Up @@ -455,14 +455,14 @@ public function Stroke($img, $xscale, $yscale)
}
if (is_array($this->grad_fromcolor)) {
// The first argument (grad_fromcolor) can be either an array or a single color. If it is an array
// then we have two choices. It can either a) be a single color specified as an RGB triple or it can be
// then we have two choices. It can either a) be a single color specified as an Image\RGB triple or it can be
// an array to specify both (from, to style) for each individual bar. The way to know the difference is
// to investgate the first element. If this element is an integer [0,255] then we assume it is an RGB
// to investgate the first element. If this element is an integer [0,255] then we assume it is an Image\RGB
// triple.
$ng = count($this->grad_fromcolor);
if ($ng === 3) {
if (is_numeric($this->grad_fromcolor[0]) && $this->grad_fromcolor[0] > 0 && $this->grad_fromcolor[0] < 256) {
// RGB Triple
// Image\RGB Triple
$fromcolor = $this->grad_fromcolor;
$tocolor = $this->grad_tocolor;
$style = $this->grad_style;
Expand Down
1 change: 1 addition & 0 deletions src/plot/Contour.php
Expand Up @@ -7,6 +7,7 @@
namespace Amenadiel\JpGraph\Plot;

use Amenadiel\JpGraph\Image;
use Amenadiel\JpGraph\Util;

/**
* File: JPGRAPH_CONTOUR.PHP
Expand Down
2 changes: 2 additions & 0 deletions src/plot/ErrorPlot.php
Expand Up @@ -6,6 +6,8 @@

namespace Amenadiel\JpGraph\Plot;

use Amenadiel\JpGraph\Util;

/**
* File: JPGRAPH_ERROR.PHP
* // Description: Error plot extension for JpGraph
Expand Down
1 change: 1 addition & 0 deletions src/plot/FieldPlot.php
Expand Up @@ -7,6 +7,7 @@
namespace Amenadiel\JpGraph\Plot;

use Amenadiel\JpGraph\Image;
use Amenadiel\JpGraph\Util;

/**
* @class FieldPlot
Expand Down
3 changes: 2 additions & 1 deletion src/plot/GanttVLine.php
Expand Up @@ -8,6 +8,7 @@

use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Text;
use Amenadiel\JpGraph\Util;

class GanttVLine extends GanttPlotObject
{
Expand All @@ -22,7 +23,7 @@ class GanttVLine extends GanttPlotObject
*/
public function __construct($aDate, $aTitle = '', $aColor = 'darkred', $aWeight = 2, $aStyle = 'solid')
{
GanttPlotObject::__construct();
parent::__construct();
$this->iLine = new Graph\LineProperty();
$this->iLine->SetColor($aColor);
$this->iLine->SetWeight($aWeight);
Expand Down
2 changes: 2 additions & 0 deletions src/plot/GroupBarPlot.php
Expand Up @@ -6,6 +6,8 @@

namespace Amenadiel\JpGraph\Plot;

use Amenadiel\JpGraph\Util;

/**
* @class GroupBarPlot
* // Description: Produce grouped bar plots
Expand Down
1 change: 1 addition & 0 deletions src/plot/IconPlot.php
Expand Up @@ -8,6 +8,7 @@

use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Image;
use Amenadiel\JpGraph\Util;

/**
* File: JPGRAPH_ICONPLOT.PHP
Expand Down
2 changes: 2 additions & 0 deletions src/plot/LineErrorPlot.php
Expand Up @@ -6,6 +6,8 @@

namespace Amenadiel\JpGraph\Plot;

use Amenadiel\JpGraph\Util;

/**
* @class LineErrorPlot
* // Description: Combine a line and error plot
Expand Down
4 changes: 2 additions & 2 deletions src/plot/LinePlot.php
Expand Up @@ -124,7 +124,7 @@ public function Legend($graph)
);
} elseif ($this->fillgrad) {
$color = [$this->fillgrad_fromcolor, $this->fillgrad_tocolor];
// In order to differentiate between gradients and cooors specified as an RGB triple
// In order to differentiate between gradients and cooors specified as an Image\RGB triple
$graph->legend->Add(
$this->legend,
$color,
Expand Down Expand Up @@ -231,7 +231,7 @@ public function Stroke($img, $xscale, $yscale)
if (isset($this->coords[1])) {
if (count($this->coords[1]) != $numpoints) {
Util\JpGraphError::RaiseL(2003, count($this->coords[1]), $numpoints);
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
//("Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])." Number of Y-points:$numpoints");
} else {
$exist_x = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/plot/MileStone.php
Expand Up @@ -19,7 +19,7 @@ class MileStone extends GanttPlotObject
*/
public function __construct($aVPos, $aLabel, $aDate, $aCaption = '')
{
GanttPlotObject::__construct();
parent::__construct();
$this->caption->Set($aCaption);
$this->caption->Align('left', 'center');
$this->caption->SetFont(FF_FONT1, FS_BOLD);
Expand Down

0 comments on commit d00c23d

Please sign in to comment.