phpdoc/Library/Tool/FileRotator.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="robots" content="index, follow, all" />
<title>Library\Tool\FileRotator | Library</title>
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../../css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="../../css/sami.css">
<script src="../../js/jquery-1.11.1.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/typeahead.min.js"></script>
<script src="../../sami.js"></script>
<meta name="MobileOptimized" content="width">
<meta name="HandheldFriendly" content="true">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
</head>
<body id="class" data-name="class:Library_Tool_FileRotator" data-root-path="../../">
<div id="content">
<div id="left-column">
<div id="control-panel">
<form id="search-form" action="../../search.html" method="GET">
<span class="glyphicon glyphicon-search"></span>
<input name="search"
class="typeahead form-control"
type="search"
placeholder="Search">
</form>
</div>
<div id="api-tree"></div>
</div>
<div id="right-column">
<nav id="site-nav" class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-elements">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">Library</a>
</div>
<div class="collapse navbar-collapse" id="navbar-elements">
<ul class="nav navbar-nav">
<li><a href="../../classes.html">Classes</a></li>
<li><a href="../../namespaces.html">Namespaces</a></li>
<li><a href="../../interfaces.html">Interfaces</a></li>
<li><a href="../../traits.html">Traits</a></li>
<li><a href="../../doc-index.html">Index</a></li>
<li><a href="../../search.html">Search</a></li>
</ul>
</div>
</div>
</nav>
<div class="namespace-breadcrumbs">
<ol class="breadcrumb">
<li><span class="label label-default">class</span></li>
<li><a href="../../Library.html">Library</a></li>
<li><a href="../../Library/Tool.html">Tool</a></li>
<li>FileRotator</li>
</ol>
</div>
<div id="page-content">
<div class="page-header">
<h1>FileRotator</h1>
</div>
<p> class
<strong>FileRotator</strong>
</p>
<div class="description">
<p>Rotate system for files</p> </div>
<h2>Constants</h2>
<table class="table table-condensed">
<tr>
<td>ROTATE_PERIODIC</td>
<td class="last">
<p><em>Use this to make a rotation based on time</em></p>
<p>
</p>
</td>
</tr>
<tr>
<td>ROTATE_FILESIZE</td>
<td class="last">
<p><em>Use it to make a rotation base on file size</em></p>
<p>
</p>
</td>
</tr>
</table>
<h2>Methods</h2>
<div class="container-fluid underlined">
<div class="row">
<div class="col-md-2 type">
</div>
<div class="col-md-8 type">
<a href="#method___construct">__construct</a>(
string $file_path,
int $flag = self::ROTATE_PERIODIC,
array $user_options = array())
<p>Creation of a new file rotator</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
bool
</div>
<div class="col-md-8 type">
<a href="#method_write">write</a>(
string $content = '')
<p>Write a string in the file</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
bool
</div>
<div class="col-md-8 type">
<a href="#method_rotate">rotate</a>(
bool $force = false)
<p>Rotate file if so</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
bool
</div>
<div class="col-md-8 type">
<a href="#method_mustRotate">mustRotate</a>()
<p>Does the current file need to be rotated</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getFilename">getFilename</a>(
string $file_name,
int $rotation_index)
<p>Get the name of a file to rotate</p> </div>
<div class="col-md-2"></div>
</div>
</div>
<h2>Details</h2>
<div id="method-details">
<div class="method-item">
<h3 id="method___construct">
<div class="location">at line 85</div>
<code>
<strong>__construct</strong>(
string $file_path,
int $flag = self::ROTATE_PERIODIC,
array $user_options = array())</code>
</h3>
<div class="details">
<div class="method-description">
<p>Creation of a new file rotator</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$file_path</td>
<td>Full path of concerned file</td>
</tr>
<tr>
<td>
int</td>
<td>$flag</td>
<td>One of the class <code>ROTATE_</code> constants</td>
</tr>
<tr>
<td>
array</td>
<td>$user_options</td>
<td>A set of one shot options</td>
</tr>
</table>
<h4>Exceptions</h4>
<table class="table table-condensed">
<tr>
<td><a target="_blank" href="http://php.net/InvalidArgumentException"><abbr title="InvalidArgumentException">InvalidArgumentException</abbr></a></td>
<td>if no <code>$file_path</code> argument</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_write">
<div class="location">at line 108</div>
<code>
bool
<strong>write</strong>(
string $content = '')</code>
</h3>
<div class="details">
<div class="method-description">
<p>Write a string in the file</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$content</td>
<td>The content to add in the file</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
bool</td>
<td>
</td>
</tr>
</table>
<h4>Exceptions</h4>
<table class="table table-condensed">
<tr>
<td><a target="_blank" href="http://php.net/RuntimeException"><abbr title="RuntimeException">RuntimeException</abbr></a></td>
<td>if an error occurred trying to rotate or write in file</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_rotate">
<div class="location">at line 138</div>
<code>
bool
<strong>rotate</strong>(
bool $force = false)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Rotate file if so</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
bool</td>
<td>$force</td>
<td>Force file rotation, even if <code>mustRotate()</code> is <code>false</code></td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
bool</td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_mustRotate">
<div class="location">at line 170</div>
<code>
bool
<strong>mustRotate</strong>()</code>
</h3>
<div class="details">
<div class="method-description">
<p>Does the current file need to be rotated</p> </div>
<div class="tags">
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
bool</td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getFilename">
<div class="location">at line 193</div>
<code>
string
<strong>getFilename</strong>(
string $file_name,
int $rotation_index)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the name of a file to rotate</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$file_name</td>
<td>
</td>
</tr>
<tr>
<td>
int</td>
<td>$rotation_index</td>
<td>
</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
Generated by <a href="http://sami.sensiolabs.org/">Sami, the API Documentation Generator</a>.
</div>
</div>
</div>
</body>
</html>