Is it possible to make a method documentation on the abstract method and whoever extends it inhered the documentation also? Example:
<?php
abstract class Math{
/**
* Method that receive two values and return the result of some operation.
* @param $a Number
* @param $b Number
*/
abstract public function values($a, $b);
}
?>
<?php
class Sum extends Math{
/**
* @return $a+$b;
*/
public function values($a, $b){
return $a+$b;
}
}
?>
<?php
class Divide extends Math{
/**
* @return $a/$b;
* @throws Exception.
*/
public function values($a, $b){
if($b != 0){
return $a/$b;
}else{
throw new Exception("Impossible to divide by 0.");
}
}
}
?>
How do I put all those informations about the method together? Currently, I work with Netbeans 7.1. Is it a IDE issue? Or is it just not how this works?
<?php
// Estabele conexão com o MySQL
$connect = mysql_connect('localhost', 'root', '123456') or die('A conexão falhou.');
// Seleciona o banco de dados
$database = mysql_select_db('monografia', $connect) or die('Falha ao tentar selecionar banco de dados.');
if ($database)
echo 'Conectado atraves do driver nativo.';
?>
<br />
<?php
class Conexao {
protected $conexao;
public function Conexao() {
$this->conexao = new MySQLi('localhost', 'root', '123456', 'monografia', 3306);
if (!$this->conexao->connect_error)
echo 'Conectado atraves da extensao MySQLi.';
}
}
new Conexao();
?>
<br />
<?php
class ConexaoPDO {
protected $pdo;
public function ConexaoPDO() {
try {
$this->pdo = new PDO('mysql:host=localhost:3306;dbname=monografia', 'root', '123456', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
echo 'Conectado atraves do PDO.';
} catch(PDOException $e) {
echo $e->getMessage();
}
}
}
new ConexaoPDO();
?>