Set to $this->usedTraits included traits
511166
private function readUsedTraits()
    {
        if ($this->traitsAutoExecute)
        {
            $calledClass = get_called_class();
            
            $classes = class_parents($calledClass);
            $classes[] = $calledClass;
            
            foreach ($classes as $class)
            {
                foreach (class_uses($class) as $trait)
                {
                    $this->usedTraits[$trait] = bx_basename($trait);
                }
            }
        }
    }
949216
public function removeTrait($trait) {
		if ($trait instanceof PhpTrait) {
			$name = $trait->getName();
		} else {
			$name = $trait;
		}

		$index = array_search($name, $this->traits);
		if ($index !== false) {
			unset($this->traits[$index]);

			if ($trait instanceof PhpTrait) {
				$qname = $trait->getQualifiedName();
				$this->removeUseStatement($qname);
			}
		}

		return $this;
	}
222726
protected function collectAllTraits()
    {
        if ($this->_allTraits === null) {
            $this->_allTraits = Type::traits($this, true);
            unset($this->_allTraits[TraitMethods::class]); // exclude this trait
        }
        return $this->_allTraits;
    }
729600
function &traits()
    {
        $traits = NULL;
        foreach ($this->_classes as $name => $trait) {
            if ($trait->isTrait()) {
                $traits[$name] =& $this->_classes[$name];
            }
        }

        return $traits;
    }
961417
protected function initAttrs()
    {
        $attrs = self::getAttrs();
        foreach ($attrs as $key => $attr) {
            if (! isset($attr['default'])) continue;
            if (! isset($this->cleanData[$key])) {
                $this->$key = $attr['default'];
            }
        }
    }
1232864
function &traitNamed($traitName)
    {
        $return = NULL;
        if (isset($this->_traits[$traitName])) {
            $return =& $this->__traits[$traitName];
        }

        return $return;
    }
120803
protected function generateTraitUsesLines()
    {
        $code = array();
        foreach ($this->traitUses as $use) {
            $use->setIndentationString($this->getIndentationString());
            $use->setIndentationLevel($this->getIndentationLevel() + 1);
            $code[] = $use->generate();
            $code[] = null;
        }

        return $code;
    }
600572
public function getTraits() {
    	if (version_compare(PHP_VERSION, "5.4.0", '<')) {
    		// I'm not using PHP 5.4 or higher
    		return array();
    	}
    	
    	if ($this->traits !== null) {
    		return $this->traits;
    	}
    	
    	$traitNames = parent::getTraitNames();
    	$this->traits = array_map(function($name) { return new MoufReflectionClass($name); }, $traitNames);
    	
    	return $this->traits;
    }
1144225
private void initAttributes(Context context, AttributeSet attributeSet) {
		
		TypedArray typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.MotionView);
		
		friction = typedArray.getFloat(R.styleable.MotionView_friction, 0.75f) * 1000;
			
		typedArray.recycle();
	}
422666
public function traits() {
        $traits = $this->reflection()->getTraitNames();
        $parent = get_parent_class($this->_class);

        while ($parent) {
            $traits = array_merge($traits, class_uses($parent));
            $parent = get_parent_class($parent);
        }

        return array_values($traits);
    }
774353
public function mark_as_used() {
	$mysql = bootstrap::get_library('mysql');
	
	$sql   = "UPDATE `login_tokens` SET `used` = 1, `last_used_at` = %d WHERE `id` = %d;";
	$binds = [time(), $this->data['id']];
	$mysql::query($sql, $binds);
}
998041
protected function setFieldOriginalValue()
    {
//        static::doNotSnakeAttributes($this->model);

        $values = $this->model->toArray();

        $this->builder->fields()->each(function (Field $field) use ($values) {
            $field->setOriginal($values);
        });
    }
1316658
protected function initOuterExtendedClasses()
    {
        $traits = ClassAnalyzer::getTraits($this);
        foreach ($traits as $trait) {
            $rc = new \ReflectionClass($trait);
            $method = preg_replace('/^Has/', 'init', $rc->getShortName(), 1);
            if ($method && $method != $rc->getShortName() && ClassAnalyzer::hasMethod($rc, $method)) {
                $this->$method();
            }
        }
    }
720502
protected function checkTraitsInjections()
    {
        $traits = $this->getUsedTraits();
        $reflection = new \ReflectionClass($this);
        foreach($traits as $trait) {
            $methodName = 'setTraitInjections' . $trait;
            if($reflection->hasMethod($methodName)) {
                $this->$methodName();
                $this->checkTraitInjections($trait);
            }
        }
    }
589114
private function deepScanTraits(array $traits, $methodFile, $methodStartLine, $methodEndLine) {
    	foreach ($traits as $trait) {
    		// If the trait has a method, is it the method we see?
    		if ($trait->getFileName() == $methodFile
    				&& $trait->getStartLine() <= $methodStartLine
    				&& $trait->getEndLine() >= $methodEndLine) {
    			return $trait;
    		}
    		return $this->deepScanTraits($trait->getTraits(), $methodFile, $methodStartLine, $methodEndLine);
    	}
    	return null;
    }
745441
public static function traits($class, $recursive=false, $autoload=true)
    {

        if (!$recursive) {
            return class_uses($class, $autoload);
        }

        $traits = [];

        // Collect the "use" statements in class and parent classes
        do {
            $traits = array_merge(class_uses($class, $autoload), $traits);
        } while ($class = get_parent_class($class));

        // Copy the found traits into an array we can alter
        $allTraits = $traits;

        foreach ($traits as $trait) {
            $allTraits += static::traitsOfTrait($trait);
        }

        return array_unique($allTraits);
    }
87105
protected function addTraits($traits, $fileDescriptor)
    {
        foreach ($traits as $trait) {
            $traitDescriptor = $this->getBuilder()->buildDescriptor($trait);
            if ($traitDescriptor) {
                $traitDescriptor->setLocation($fileDescriptor, $trait->getLineNumber());
                if (count($traitDescriptor->getTags()->get('package', new Collection())) == 0) {
                    $traitDescriptor->getTags()
                        ->set('package', $fileDescriptor->getTags()->get('package', new Collection()));
                }

                $fileDescriptor->getTraits()->set(
                    $traitDescriptor->getFullyQualifiedStructuralElementName(),
                    $traitDescriptor
                );
            }
        }
    }