Advertisement
SashaRaaa

Untitled

Jul 25th, 2018
1,369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. require __DIR__ . '/classArticle.php';
  4.  
  5. class News
  6. {
  7.    
  8.     protected $records;
  9.    
  10.     public function __construct($file)
  11.     {
  12.          $lines = file(__DIR__. $file);
  13.          $this->records = [];
  14.          foreach ($lines as $line) {
  15.              $arr = explode('///', $line);
  16.              $this->records[] = new Article($arr[0], $arr[1], $arr[2]);
  17.  
  18.          }
  19.     }
  20.  
  21.     public function getNews()
  22.     {
  23.         return $this->records;
  24.     }
  25.    
  26.    
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement