Code Duplication    Length = 12-12 lines in 3 locations

phpsysinfo/includes/os/class.Darwin.inc.php 3 locations

@@ 232-243 (lines=12) @@
229
     *
230
     * @return void
231
     */
232
    protected function usb()
233
    {
234
        $s = $this->_grabioreg('IOUSBDevice');
235
        $lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
236
        foreach ($lines as $line) {
237
                    $dev = new HWDevice();
238
                    if (!preg_match('/"USB Product Name" = "([^"]*)"/', $line, $ar_buf))
239
                       $ar_buf = preg_split("/[\s@]+/", $line, 19);
240
                    $dev->setName(trim($ar_buf[1]));
241
                    $this->sys->setUsbDevices($dev);
242
        }
243
    }
244
245
    /**
246
     * get the scsi device information out of ioreg
@@ 250-261 (lines=12) @@
247
     *
248
     * @return void
249
     */
250
    protected function scsi()
251
    {
252
        $s = $this->_grabioreg('IOBlockStorageServices');
253
        $lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
254
        foreach ($lines as $line) {
255
                    $dev = new HWDevice();
256
                    if (!preg_match('/"Product Name"="([^"]*)"/', $line, $ar_buf))
257
                       $ar_buf = preg_split("/[\s@]+/", $line, 19);
258
                    $dev->setName(trim($ar_buf[1]));
259
                    $this->sys->setScsiDevices($dev);
260
        }
261
    }
262
263
    /**
264
     * get memory and swap information
@@ 333-344 (lines=12) @@
330
     *
331
     * @return void
332
     */
333
    protected function _tb()
334
    {
335
        $s = $this->_grabioreg('IOThunderboltPort');
336
        $lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
337
        foreach ($lines as $line) {
338
                    $dev = new HWDevice();
339
                    if (!preg_match('/"Description" = "([^"]*)"/', $line, $ar_buf))
340
                       $ar_buf = preg_split("/[\s@]+/", $line, 19);
341
                    $dev->setName(trim($ar_buf[1]));
342
                    $this->sys->setTbDevices($dev);
343
        }
344
    }
345
346
    /**
347
     * get network information