PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 1.31
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v1.31
2.1.0 2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 All 42 releases
fluent-boards / vendor / wpfluent / framework / src / WPFluent / Support / HelperFunctionsTrait.php

HelperFunctionsTrait.php in FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration 1.31, at vendor/wpfluent/framework/src/WPFluent/Support/HelperFunctionsTrait.php

56 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBoards\Framework\Support;
4
5
6 trait HelperFunctionsTrait
7 {
8 /**
9 * Get the class base name
10 *
11 * @param mixed $class
12 * @return string
13 */
14 public static function classBasename($class)
15 {
16 $class = is_object($class) ? get_class($class) : $class;
17 return basename(str_replace('\\', '/', $class));
18 }
19
20 /**
21 * Retrive all traits used by a class, including traits used by all of its parent classes.
22 * @param string|object $class
23 * @return array
24 */
25 public static function classUsesRecursive($class)
26 {
27 if (is_object($class)) {
28 $class = get_class($class);
29 }
30
31 $results = [];
32
33 foreach (array_reverse(class_parents($class)) + [$class => $class] as $class) {
34 $results += static::traitUsesRecursive($class);
35 }
36
37 return array_unique($results);
38 }
39
40 /**
41 * Retrieve all traits used by a trait
42 * @param string $trait
43 * @return array
44 */
45 public static function traitUsesRecursive($trait)
46 {
47 $traits = class_uses($trait) ?: [];
48
49 foreach ($traits as $trait) {
50 $traits += static::traitUsesRecursive($trait);
51 }
52
53 return $traits;
54 }
55 }
56