Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PicaReader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dmj
PicaReader
Commits
5c879dc7
Commit
5c879dc7
authored
12 years ago
by
David Maus
Browse files
Options
Downloads
Patches
Plain Diff
Declare Reader::open(), Reader::close() abstract; accept stream or string
parent
98d9506d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/HAB/Pica/Reader/PicaPlainReader.php
+4
-5
4 additions, 5 deletions
src/HAB/Pica/Reader/PicaPlainReader.php
src/HAB/Pica/Reader/PicaXmlReader.php
+6
-8
6 additions, 8 deletions
src/HAB/Pica/Reader/PicaXmlReader.php
src/HAB/Pica/Reader/Reader.php
+10
-18
10 additions, 18 deletions
src/HAB/Pica/Reader/Reader.php
with
20 additions
and
31 deletions
src/HAB/Pica/Reader/PicaPlainReader.php
+
4
−
5
View file @
5c879dc7
...
...
@@ -38,15 +38,15 @@ class PicaPlainReader extends Reader
*/
protected
$_data
;
/**
* Open the reader with input
data
.
* Open the reader with input
stream
.
*
* @param
string $data Input data
* @param
resource|string $stream
* @return void
*/
public
function
open
(
$data
)
{
parent
::
open
(
$data
);
$this
->
_data
=
preg_split
(
"/(?:
\n\r
|[
\n\r
])/"
,
$data
);
}
...
...
@@ -68,13 +68,12 @@ class PicaPlainReader extends Reader
}
/**
* Close
the
reader.
* Close reader.
*
* @return void
*/
public
function
close
()
{
parent
::
close
();
$this
->
_data
=
null
;
}
}
This diff is collapsed.
Click to expand it.
src/HAB/Pica/Reader/PicaXmlReader.php
+
6
−
8
View file @
5c879dc7
...
...
@@ -53,18 +53,17 @@ class PicaXmlReader extends Reader
}
/**
*
Prepare
the reader
for reading data
.
*
Open
the reader
with input stream
.
*
* @param
string|
resource
$input
* @param resource
|string $stream
* @return void
*/
public
function
open
(
$
input
)
public
function
open
(
$
stream
)
{
if
(
is_resource
(
$
input
))
{
$
input
=
stream_get_contents
(
$
input
);
if
(
is_resource
(
$
stream
))
{
$
stream
=
stream_get_contents
(
$
stream
);
}
$this
->
_xmlReader
->
XML
(
$input
);
parent
::
open
(
$input
);
$this
->
_xmlReader
->
xml
(
$stream
);
}
/**
...
...
@@ -75,7 +74,6 @@ class PicaXmlReader extends Reader
public
function
close
()
{
$this
->
_xmlReader
->
close
();
parent
::
close
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/HAB/Pica/Reader/Reader.php
+
10
−
18
View file @
5c879dc7
...
...
@@ -59,17 +59,19 @@ abstract class Reader
{}
/**
* Open the reader with input
data
.
* Open the reader with input
stream
.
*
* @param resource|string $stream
* @return void
*/
public
function
open
(
$data
)
{
if
(
$this
->
isOpen
())
{
$this
->
close
();
}
$this
->
_isOpen
=
true
;
}
abstract
public
function
open
(
$stream
);
/**
* Close reader.
*
* @return void
*/
abstract
public
function
close
();
/**
* Return next record in input data or FALSE if no more records.
...
...
@@ -134,16 +136,6 @@ abstract class Reader
$this
->
_filter
=
null
;
}
/**
* Close the reader.
*
* @return void
*/
public
function
close
()
{
$this
->
_isOpen
=
false
;
}
/**
* Return true if the reader is open.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment