Skip to content

Commit

Permalink
Merge pull request #48 from PHPJasper/php7
Browse files Browse the repository at this point in the history
v2
  • Loading branch information
geekcom authored May 26, 2017
2 parents 88ef738 + f39e095 commit a664b07
Show file tree
Hide file tree
Showing 15 changed files with 167 additions and 173 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ This package is the solution to compile and process JasperReports (.jrxml & .jas
Do not forget to grant the correct permissions for the directory
**/vendor/geekcom/phpjasper/bin/jasperstarter/bin** and the file binary **jasperstarter**

**Do you need to generate Python reports?**

Meet the **[pyreport](https://github.com/jadsonbr/pyreport)**

### Why PHPJasper?

Did you ever had to create a good looking Invoice with a lot of fields for your great web app?
Expand Down Expand Up @@ -51,8 +47,8 @@ Package to generate reports with [JasperReports 6.3.1](http://community.jasperso

## Requirements

* PHP 7.1 or above
* Java JDK 1.8
* PHP [exec()](http://php.net/manual/function.exec.php) function

## Optional

Expand Down
15 changes: 10 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@
"role": "lead"
}
],
"minimum-stability": "dev",
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"php": ">=7.1",
"symfony/console": "^3.2"
},
"require-dev": {
"phpunit/phpunit": "4.8.*"
"phpunit/phpunit": "^6.1"
},
"autoload": {
"psr-4": {
"JasperPHP\\": "src/"
"PHPJasper\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"PHPJasper\\": "tests/"
}
}
}
}
6 changes: 1 addition & 5 deletions docs/pt_BR/LEIA-ME_pt_BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ Este pacote é a solução perfeita para compilar e processar relatórios Jasper
Não esqueça de fornecer as permissões devidas para o diretório
**/vendor/geekcom/phpjasper/bin/jasperstarter/bin** e para o arquivo binário **jasperstarter**

**Precisa gerar relatórios em Python?**

Conheça a biblioteca **[pyreport](https://github.com/jadsonbr/pyreport)**

### Por quê preciso do PHPJasper?

Alguma vez você precisou de um relatório simples ou complexo em PHP para seu sistema web?
Expand All @@ -48,8 +44,8 @@ Apresento para vocês **JasperReports** a melhor solução open source que exist

## Requisitos

* PHP 7.1 em diante
* Java JDK 1.8
* PHP [exec()](http://php.net/manual/function.exec.php) function

## Opcional

Expand Down
5 changes: 3 additions & 2 deletions phpunit.xml.dist → phpunit.xml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
<phpunit bootstrap="./vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
Expand All @@ -11,7 +12,7 @@

<filter>
<whitelist>
<directory>src/JasperPHP</directory>
<directory>src/PHPJasper</directory>
<directory>src/JasperStarter</directory>
</whitelist>
</filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
namespace JasperPHP;
namespace PHPJasper;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class JasperPHPCommand extends Command
class PHPJasperCommand extends Command
{
/**
*
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ErrorCommandExecutable.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace JasperPHP\Exception;
namespace PHPJasper\Exception;
/**
* Class ErrorCommandExecutable
* @package JasperPHP\Exception
* @package PHPJasper\Exception
*/
class ErrorCommandExecutable extends \Exception
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/InvalidCommandExecutable.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace JasperPHP\Exception;
namespace PHPJasper\Exception;
/**
* Class InvalidCommandExecutable
* @package JasperPHP\Exception
* @package PHPJasper\Exception
*/
class InvalidCommandExecutable extends \Exception
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/InvalidFormat.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace JasperPHP\Exception;
namespace PHPJasper\Exception;
/**
* Class InvalidFormat
* @package JasperPHP\Exception
* @package PHPJasper\Exception
*/
class InvalidFormat extends \Exception
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/InvalidInputFile.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace JasperPHP\Exception;
namespace PHPJasper\Exception;
/**
* Class InvalidInputFile
* @package JasperPHP\Exception
* @package PHPJasper\Exception
*/
class InvalidInputFile extends \Exception
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/InvalidResourceDirectory.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace JasperPHP\Exception;
namespace PHPJasper\Exception;
/**
* Class InvalidResourceDirectory
* @package JasperPHP\Exception
* @package PHPJasper\Exception
*/
class InvalidResourceDirectory extends \Exception
{
Expand Down
26 changes: 14 additions & 12 deletions src/JasperPHP.php → src/PHPJasper.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php
namespace JasperPHP;

namespace PHPJasper;

/**
* Class JasperPHP
* @package JasperPHP
* Class PHPJasper
* @package PHPJasper
*/
class JasperPHP
class PHPJasper
{

/**
Expand Down Expand Up @@ -33,7 +35,7 @@ class JasperPHP
protected $formats = ['pdf', 'rtf', 'xls', 'xlsx', 'docx', 'odt', 'ods', 'pptx', 'csv', 'html', 'xhtml', 'xml', 'jrprint'];

/**
* JasperPHP constructor
* PHPJasper constructor
*/
public function __construct()
{
Expand All @@ -51,7 +53,7 @@ public function __construct()
public function compile($input_file, $output_file = false)
{
if (!$input_file) {
throw new \JasperPHP\Exception\InvalidInputFile();
throw new \PHPJasper\Exception\InvalidInputFile();
}

$this->command = $this->windows ? $this->executable : './' . $this->executable;
Expand All @@ -78,7 +80,7 @@ public function process($input_file, $output_file = false, $options = [])
{
$options = $this->parseProcessOptions($options);
if (!$input_file) {
throw new \JasperPHP\Exception\InvalidInputFile();
throw new \PHPJasper\Exception\InvalidInputFile();
}
$this->validateFormat($options['format']);

Expand Down Expand Up @@ -154,7 +156,7 @@ protected function validateFormat($format)
}
foreach ($format as $value) {
if (!in_array($value, $this->formats)) {
throw new \JasperPHP\Exception\InvalidFormat();
throw new \PHPJasper\Exception\InvalidFormat();
}
}
}
Expand All @@ -167,7 +169,7 @@ protected function validateFormat($format)
public function listParameters($input_file)
{
if (!$input_file) {
throw new \JasperPHP\Exception\InvalidInputFile();
throw new \PHPJasper\Exception\InvalidInputFile();
}

$this->command = $this->windows ? $this->executable : './' . $this->executable;
Expand Down Expand Up @@ -195,7 +197,7 @@ public function execute($user = false)
chdir($this->path_executable);
exec($this->command, $output, $return_var);
if ($return_var !== 0) {
throw new \JasperPHP\Exception\ErrorCommandExecutable();
throw new \PHPJasper\Exception\ErrorCommandExecutable();
}

return $output;
Expand Down Expand Up @@ -226,10 +228,10 @@ protected function addUserToCommand($user)
protected function validateExecute()
{
if (!$this->command) {
throw new \JasperPHP\Exception\InvalidCommandExecutable();
throw new \PHPJasper\Exception\InvalidCommandExecutable();
}
if (!is_dir($this->path_executable)) {
throw new \JasperPHP\Exception\InvalidResourceDirectory();
throw new \PHPJasper\Exception\InvalidResourceDirectory();
}

}
Expand Down
11 changes: 0 additions & 11 deletions tests/JasperPHP/JasperPHPCommandTest.php

This file was deleted.

121 changes: 0 additions & 121 deletions tests/JasperPHP/JasperPHPTest.php

This file was deleted.

13 changes: 13 additions & 0 deletions tests/PHPJasper/PHPJasperCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace PHPJasper\Test;

use PHPUnit\Framework\TestCase;

class PHPJasperCommandTest extends TestCase
{
public function testBasic()
{
$this->assertNull(null);
}
}
Loading

0 comments on commit a664b07

Please sign in to comment.