Skip to content

Commit 3de8680

Browse files
committed
tried to get the extension to work..
I've updated the raffle script (test.php) in order to dynamically read the given file, add the names. The problem is... all it currently does is return "yes" ?
1 parent dfcddbd commit 3de8680

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

jaytaph-php7-extension/Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM alpine:3.4
2+
3+
4+
# build it and they will com.. pile
5+
RUN apk add --no-cache autoconf gcc g++ make
6+
7+
# Create working dir
8+
RUN mkdir -p /var/app
9+
COPY . /var/app
10+
WORKDIR /var/app
11+
12+
# compile it and they will raffle
13+
RUN phpize && \
14+
./configure && \
15+
make && \
16+
make install &&
17+
echo "extension=domcode.so" >> /usr/local/etc/php/conf.d/domcode.ini
18+
19+
CMD ["php", "test.php", "/var/names/current"]
20+

jaytaph-php7-extension/test.php

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<?php
22

3-
$d = new DomCode();
4-
$d->addname('foo');
5-
$d->addname('bar');
6-
$d->addname('baz');
3+
$filename = !empty($argv[1]) && is_readable($argv[1]) ? realpath($argv[1]) : '';
4+
if (empty($filename)) {
5+
die('please use `php test.php path_to_file`');
6+
}
77

8-
echo $d->raffle();
8+
$d = new DomCode();
9+
foreach (array_filter(file($filename)) as $name) {
10+
$d->addname($name);
11+
}
12+
echo $d->raffle().PHP_EOL;

0 commit comments

Comments
 (0)