Skip to content

Commit d659d01

Browse files
author
Martin Brecht-Precht
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # QrEncode/Exception/QrEncoderException.php # QrRender/Exception/IoException.php # QrRender/QrCodeRendererPng.php # QrRender/QrCodeRendererTiff.php # README.md # composer.json # src/QrEncode/QrCode/QrCode.php # src/QrEncode/QrCode/QrCodePoint.php # src/QrEncode/QrCode/QrCodePointRow.php # src/QrEncode/QrEncoder.php # src/QrRender/Base/QrCodeRendererInterface.php # src/QrRender/PathFinder/Path.php # src/QrRender/PathFinder/PathPoint.php # src/QrRender/PathFinder/QrCodePathFinder.php # src/QrRender/QrCodeRendererEps.php
2 parents b08ca7b + d2d1e17 commit d659d01

29 files changed

+1085
-4
lines changed

.codeclimate.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ ratings:
2525
- "**.rb"
2626
exclude_paths:
2727
- test/
28-
- vendor/
28+
- vendor/

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/vendor
2-
composer.lock
2+
composer.lock
3+
vagrantfile

.sensiolabs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rules:
2+
php.duplicated_code:
3+
enabled: false

.travis.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
language: php
2+
3+
branches:
4+
only:
5+
- master
6+
7+
php:
8+
- '5.3'
9+
- '5.4'
10+
- '5.5'
11+
- '7.0'
12+
- hhvm
13+
14+
matrix:
15+
allow_failures:
16+
- php: hhvm
17+
- php: '5.3'
18+
19+
before_install:
20+
- sudo apt-get -qq update
21+
- sudo apt-get install -y qrencode
22+
- pear config-set preferred_state beta
23+
- printf "\n" | pecl install imagick
24+
- echo "extension=imagick.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
25+
- php -m
26+
27+
install:
28+
- composer install
29+
30+
before_script:
31+
- mkdir -p build/logs
32+
33+
script:
34+
- phpunit --coverage-clover build/logs/clover.xml
35+
36+
after_success:
37+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" -a "$TRAVIS_PHP_VERSION" != "5.3" ]; then CODECLIMATE_REPO_TOKEN=fa42f567b7666793956a507e50d3a8b9bb833a9a1183cb543bedd2ea5cafb8be ./vendor/bin/test-reporter; fi;'

CONTRIBUTING.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,36 @@ Any bugfix that doesn’t include a test proving the existence of the bug being
6868

6969
We’ve found that test-first development really helps make features better architected and identifies potential edge cases earlier instead of later. Writing tests before the implementation is strongly encouraged.
7070

71+
Sometimes testing is hard because it is not possible to create an environment on the developers machine to fulfill the softwares requirements in the middleware setup. For example installing imagick on Mac OS X could be a task straight out of hell. In this case it is useful to provide a out-of-the-box running machine setup like [docker](https://www.docker.com/) ot [vagrant](https://www.vagrantup.com/) and run tests on the virtual machine via the commandline interface.
72+
73+
## Contributing requirements
74+
75+
For development purposes there is a [vagrant](https://www.vagrantup.com/) setup included in the repo to fulfill the server side requirements easily.
76+
77+
### Installation and testing example (Mac OS X)
78+
79+
#### Installation of vagrant
80+
81+
Get your vagrant version from [https://www.vagrantup.com/downloads.html](https://www.vagrantup.com/downloads.html) and run the installer.
82+
83+
#### Starting the virtual machine and connect via SSH
84+
85+
```
86+
cd php-qr-code-suite
87+
vagrant up
88+
vagrant ssh
89+
```
90+
91+
#### Running the tests via command line interface
92+
93+
```
94+
cd /var/www/php-qr-code-suite
95+
phpunit --bootstrap vendor/autoload.php --configuration phpunit.xml.dist
96+
```
97+
7198
## Full example
7299

73-
Here’s an example workflow for `php-qr-code-suite` hosted on Github, which is currently in version 2.0.x. Your username is `yourname` and you’re submitting a basic bugfix.
100+
Here’s an example workflow for `php-qr-code-suite` hosted on Github, which is currently in version 3.0.8. Your username is `yourname` and you’re submitting a basic bugfix.
74101

75102
### Preparing your Fork
76103

@@ -85,7 +112,7 @@ git clone git@github.com:yourname/php-qr-code-suite
85112

86113
```
87114
cd php-qr-code-suite
88-
git checkout -b foo-the-bars 2.0
115+
git checkout -b fix-issue-269 3.0.8
89116
```
90117

91118
### Making your Changes

phpunit.xml.dist

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit colors="true" bootstrap="vendor/autoload.php">
3+
<testsuites>
4+
<testsuite name="QR Code Suite Testsuite">
5+
<directory>test</directory>
6+
</testsuite>
7+
</testsuites>
8+
<filter>
9+
<whitelist>
10+
<directory suffix=".php">./src</directory>
11+
<exclude>
12+
<directory>./vendor</directory>
13+
<directory>./test</directory>
14+
</exclude>
15+
</whitelist>
16+
</filter>
17+
</phpunit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Markenwerk\QrCodeSuite\QrEncode\Exception;
4+
5+
/**
6+
* Class QrEncoderException
7+
*
8+
* @package Markenwerk\QrCodeSuite\QrEncode\Exception
9+
*/
10+
class QrEncoderException extends \Exception
11+
{
12+
13+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
3+
namespace Markenwerk\QrCodeSuite\QrRender;
4+
5+
/**
6+
* Class AbstractPixelRenderer
7+
*
8+
* @package Markenwerk\QrCodeSuite\QrRender
9+
*/
10+
abstract class AbstractPixelRenderer
11+
{
12+
13+
/**
14+
* @var int
15+
*/
16+
private $approximateSize = 1000;
17+
18+
/**
19+
* @var int
20+
*/
21+
private $width;
22+
23+
/**
24+
* @var int
25+
*/
26+
private $height;
27+
28+
/**
29+
* @return int
30+
*/
31+
public function getApproximateSize()
32+
{
33+
return $this->approximateSize;
34+
}
35+
36+
/**
37+
* @param int $approximateSize
38+
* @return $this
39+
*/
40+
public function setApproximateSize($approximateSize)
41+
{
42+
if (!is_int($approximateSize) || $approximateSize < 0 || $approximateSize > 5000) {
43+
throw new \InvalidArgumentException('Approximate size has to be a positive integer less than 5000');
44+
}
45+
$this->approximateSize = $approximateSize;
46+
return $this;
47+
}
48+
49+
/**
50+
* @return int
51+
*/
52+
public function getWidth()
53+
{
54+
return $this->width;
55+
}
56+
57+
/**
58+
* @param int $width
59+
* @return $this
60+
*/
61+
protected function setWidth($width)
62+
{
63+
$this->width = $width;
64+
return $this;
65+
}
66+
67+
/**
68+
* @return int
69+
*/
70+
public function getHeight()
71+
{
72+
return $this->height;
73+
}
74+
75+
/**
76+
* @param int $height
77+
* @return $this
78+
*/
79+
protected function setHeight($height)
80+
{
81+
$this->height = $height;
82+
return $this;
83+
}
84+
85+
}

0 commit comments

Comments
 (0)