PageRenderTime 54ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/SimplOn/Datas/PrintF.php

http://github.com/SimplOnPHP/SimplOnPHP
PHP | 51 lines | 12 code | 2 blank | 37 comment | 1 complexity | 636c6c6bfa52c3713e3965be3cde49a8 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. /*
  3. Copyright © 2011 Rubén Schaffer Levine and Luca Lauretta <http://simplonphp.org/>
  4. This file is part of “SimplOn PHP”.
  5. “SimplOn PHP” is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation version 3 of the License.
  8. “SimplOn PHP” is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with “SimplOn PHP”. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. namespace SimplOn\Datas;
  16. /**
  17. * PrintF data type
  18. *
  19. * This is a PrintF data type which allow you print a text with format.
  20. *
  21. * @author Rubén Schaffer Levine and Luca Lauretta <http://simplonphp.org/>
  22. * @copyright (c) 2011, Rubén Schaffer Levine and Luca Lauretta
  23. * @category Data
  24. */
  25. class PrintF extends ComplexData {
  26. /**
  27. *
  28. * Function val - The function checks if the value is null,if it's returns showView.
  29. *
  30. */
  31. public function val($val=null){
  32. if(!isset($val)){
  33. return $this->showView();
  34. }
  35. }
  36. /**
  37. *
  38. * Function showView - This function overwrite the original showView
  39. * function to show an output with format.
  40. *
  41. */
  42. public function showView($fill = null){
  43. return vsprintf(array_shift($this->sources), $this->sources);
  44. }
  45. }