# classes/phing/filters/HeadFilter.php

## \HeadFilter
jump to top

Reads the first <code>n</code> lines of a stream.

(Default is first 10 lines.)

<

p> Example:

Or:

Extends from
  \BaseParamFilterReader
Implements
  \ChainableReader
see
  \FilterReader
access
  public
author
  Yannick Lecaillez
author
  hans lellelid, hans@velum.net
copyright
  © 2003 seasonfive. All rights reserved
package
  phing.filters
version
  $Revision: 526 $ $Date: 2009-08-11 14:11:17 +0200 (Tue, 11 Aug 2009) $

### Constants

`LINES_KEY = 'lines'`

Parameter name for the number of lines to be returned.

### Properties

`integer $_lines= '10'`

Number of lines to be returned in the filtered stream.

Default value `10` Details

Type
  integer

`integer $_linesRead= '0'`

Number of lines currently read in.

Default value `0` Details

Type
  integer

### Methods

`_initialize( ) :`
Scans the parameters list for the "lines" parameter and uses it to set the number of lines to be returned in the filtered stream.
`chain( object $reader ) : object`
Creates a new HeadFilter using the passed in Reader for instantiation.
Parameters

Name | Type | Description
--- | --- | ---
$reader | object | A Reader object providing the underlying stream. Must not be `null`.

Returns

Type | Description
--- | ---
object |

`getLines( ) : integer`
Returns the number of lines to be returned in the filtered stream.
Returns

Type | Description
--- | ---
integer |

`read( $len = null ) : \the`
Returns first n lines of stream.
Parameters

Name | Type | Description
--- | --- | ---
$len |  |

Returns

Type | Description
--- | ---
\the |

Details

exception
  IOException if the underlying stream throws an IOException during reading

`setLines( integer $lines ) :`
Sets the number of lines to be returned in the filtered stream.
Parameters

Name | Type | Description
--- | --- | ---
$lines | integer | the number of lines to be returned in the filtered stream.

Documentation was generated by DocBlox 0.13.1.